34 Commits fda837cbde ... d4325f866d

Autore SHA1 Messaggio Data
  Jeison Yehuda Amihud (Blender Dumbass) d4325f866d .desktop 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 2a006069e9 .desktop 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 8a4b08f98f .desktop 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 4e662ac201 .desktop 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 5d90cb249f Merge branch 'rss' of vertbyqb/FastLBRY-terminal into master 3 anni fa
  vertbyqb f959a85e29 Get RSS link for signing channel if publication is not a channel 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 99ffe28b14 Merge branch 'edit-comments' of vertbyqb/FastLBRY-terminal into master 3 anni fa
  vertbyqb 498edf48d2 Get RSS link from channel in channel command 3 anni fa
  vertbyqb 9cb92e47f2 Get RSS link from channel 3 anni fa
  vertbyqb 00c6a4b452 Edit and delete comments 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) c92f0accea Merge branch 'no-title' of vertbyqb/FastLBRY-terminal into master 3 anni fa
  vertbyqb 9b6990579d use center() and bdrd option for error 3 anni fa
  vertbyqb a86e0b6c7c `channel` on anonymous channels leads to error 3 anni fa
  vertbyqb 66d04b3d34 Return '[no title]' in url.py if the channel doesn't have a title 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 9f871d4b91 Fixing Channel 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 4e89982513 Auto-Complete 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) d27933e66f Auto-Complete 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) ab6db3827a Auto-Complete 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 2efe867037 Update 'README.md' 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 259d9e8946 Update 'README.md' 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) d32a2352e3 Merge branch 'subscriptions' of vertbyqb/FastLBRY-terminal into master 3 anni fa
  vertbyqb f533baa97b Try to fix merge conflict 3 anni fa
  vertbyqb a211986890 Update docs 3 anni fa
  vertbyqb e63a225579 Make lbrynet executable 3 anni fa
  vertbyqb 9d70747bde Following command 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 1b85b06640 gitignore 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 1f71902fe7 Inbox Implementation 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) e95b5db82c Inbox Implementation 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 95957710ef Inbox Implementation 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 6212a61b58 Making it more readable 3 anni fa
  Jeison Yehuda Amihud (Blender Dumbass) 6df550546d Merge branch 'balance-fix' of vertbyqb/FastLBRY-terminal into master 3 anni fa
  vertbyqb 79537ad8c4 Get up to date with upstream 3 anni fa
  vertbyqb 8bbb3c6a9a Change Reserved Balance Information to Title Case 3 anni fa
  vertbyqb c6f2d881dd Make balance command fit in 3 anni fa
10 ha cambiato i file con 616 aggiunte e 20 eliminazioni
  1. 2 0
      .gitignore
  2. 2 1
      README.md
  3. 21 4
      flbry/channel.py
  4. 309 2
      flbry/comments.py
  5. 127 0
      flbry/following.py
  6. 0 0
      flbry/lbrynet
  7. 17 0
      flbry/publish.py
  8. 76 0
      flbry/settings.py
  9. 62 13
      flbry/url.py
  10. 0 0
      flbry/variables.py

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+flbry/__pycache__
+inbox.json

+ 2 - 1
README.md

@@ -65,7 +65,8 @@ To get an idea of what to work on, there is a checklist of things. Alternatively
  - [x] See balance
  - [ ] Login *( currently requires to [login from LBRY Desktop](https://notabug.org/jyamihud/FastLBRY-terminal/src/master/help/login.md) )* [Issue #17](https://notabug.org/jyamihud/FastLBRY-terminal/issues/17)
  - [ ] Send support / send lbc to addresses [Issue #10](https://notabug.org/jyamihud/FastLBRY-terminal/issues/10) and [Issue #16](https://notabug.org/jyamihud/FastLBRY-terminal/issues/16)
- - [ ] View Following [Issue #13](https://notabug.org/jyamihud/FastLBRY-terminal/issues/13)
+ - [x] View Following [~~Issue #13~~](https://notabug.org/jyamihud/FastLBRY-terminal/issues/13)
+ - [ ] Follow new channels [Issue #14](https://notabug.org/jyamihud/FastLBRY-terminal/issues/14)
 
 **Nice to have things**
 

+ 21 - 4
flbry/channel.py

@@ -42,7 +42,7 @@ def simple(args=""):
     # The user might write the search argument right in the same
     # line as the work search.
     #
-    # : seach blenderdumbass
+    # : channel blenderdumbass
     #
     # Or they can type nothing. And be confused of what happened.
     # So I want to provide a catcher here. If they type nothing it
@@ -135,6 +135,15 @@ def simple(args=""):
 
         # Making sure that we stop every time a new page is reached
         c =  input(typing_dots())
+
+        if c == "rss":
+            rss = out["items"][0]["signing_channel"]["short_url"]
+            rss = rss.replace("#", ":")
+            rss = rss.split("lbry://", 1)[1]
+
+            print("   https://odysee.com/$/rss/"+rss)
+            c =  input(typing_dots())
+
         if c != "more":
             break
     try:
@@ -171,9 +180,17 @@ def select(message="", claim_id=False):
     d = {"categories":["lbry url", "title"],
          "size":[1,2],
          "data":[]}
-    
-    for n, i in enumerate(out["items"]):        
-        d["data"].append([i["name"], i["value"]["title"]])
+
+    for n, i in enumerate(out["items"]):
+        name = "[no name]"
+        title = "[no title]"
+        try:
+            name = i["name"]
+            title = i["value"]["title"]
+        except:
+            pass
+        
+        d["data"].append([name, title])
 
     table(d)
     center("select a channel by typing it's number")

+ 309 - 2
flbry/comments.py

@@ -177,6 +177,17 @@ def view(i):
      # The help thing
      center("--- for comment commands list type 'help' --- ")
 
+     # List of commands for autocomplete feature.
+     complete([
+         "help",
+         "read",
+         "channel",
+         "comments",
+         "reply",
+         "delete",
+         "edit"
+     ])
+     
      # let's implement commands
      while True:
         c =  input(typing_dots())
@@ -204,6 +215,19 @@ def view(i):
         elif c.startswith("reply"):
             c = c + ' '
             post(i["claim_id"], c[c.find(" "):], i["comment_id"])
+        elif c == "delete":
+            out = check_output(["flbry/lbrynet", "comment", "abandon", i["comment_id"]])
+            out = json.loads(out)
+            try:
+                if out["abandoned"] == True:
+                    center("Comment deleted!", "bdgr")
+                    break
+            except:
+                if out["message"].startswith("Couldn't find channel with channel_id"):
+                    center("You can't delete a comment you didn't post", "bdrd")
+        elif c.startswith("edit"):
+            c = c + ' '
+            update(i, c[c.find(" "):])
             
 
 def post(claim_id, args,  parent_id=""):
@@ -240,6 +264,7 @@ def post(claim_id, args,  parent_id=""):
             os.system(a+" /tmp/fastlbrycommentwriter.txt")
 
             center("Press Enter when the file is ready and saved.")
+            input()
 
             text = open("/tmp/fastlbrycommentwriter.txt", "r")
             text = text.read()
@@ -271,6 +296,288 @@ def post(claim_id, args,  parent_id=""):
 
     out = json.loads(out)
     if "message" in out:
-        print("    "+clr["bbrd"]+clr["bold"]+wdth(out["message"], 89)+clr["norm"])
+        print("ERROR! "+out["message"], "bdrf")
+    else:
+        center("Comment is sent.", "bdgr")
+
+def inbox(opt=10):
+
+    # This function will return the latest comments from the latest
+    # publications. Similar to an email inbox. But with a limitation.
+
+    # There is no system in the SDK to implement a history of comments
+    # seamlessly. So then I need to cash a large file of comments. Or
+    # do something clever. I think there will be a few options.
+
+    # You noticed the opt=10 preset on the top. It's the default value.
+    # Basically the user might type one of 4 things.
+
+    #    inbox
+    #    inbox 40     (or any number what so ever)
+    #    inbox all
+    #    inbox cashed
+
+    # Each will run a slightly different algorithm to get the inbox
+    # comments.
+
+    #    inbox
+
+    # This will use the predefined 10 and read last 10 publications
+    # comments to add. It will combine them with the pre-cashed ones
+    # for the user to view. As you may imagine, giving it a number as
+    # in:
+
+    #    inbox 40
+    #    inbox 2
+    #    inbox 50
+
+    # Will load this number of publications. To update with them the
+    # cash and then present it to the user.
+
+    #    inbox all
+
+    # This one will take longest. But might be useful for some users.
+    # This will go through all publications and cash comments from all
+    # of them.
+
+    #    inbox cashed
+
+    # This one is the fastest of them. It will only read the cash file
+    # and present it to the user. So for instance you want to quickly
+    # go back to the inbox without loading anything at all.
+
+    
+    try:
+        opt = int(opt)
+        reached = opt
+        goal = opt
+    except:
+        goal = 0
+        if opt == "all":
+            reached = True
+        else:
+            reached = False
+
+    # Updating the cash file ( inbox.json )
+    page = 0
+    items_total = 0
+    current_item = 0
+
+    
+
+    try:
+        with open('inbox.json') as json_file: 
+            comments_cache = json.load(json_file)
+    except:
+        comments_cache = []
+        
+    checked_publications = []
+    
+    while reached > 0:
+
+        if type(reached) == int:
+            reached = reached - 50
+
+        page = page + 1
+        page_size = 50
+
+        # Getting data about publications.
+
+
+        if page != 1:
+            out = check_output(["flbry/lbrynet",
+                         "stream", "list",
+                         '--page='+str(page),
+                         '--page_size='+str(page_size),
+                            "--no_totals"])
+        else:
+            out = check_output(["flbry/lbrynet",
+                         "stream", "list",
+                         '--page='+str(page),
+                                '--page_size='+str(page_size)])
+
+            
+
+        # Now we want to parse the json
+        items = []
+        try:
+            out = json.loads(out)
+            items = out["items"]
+        except:
+            break
+
+        if not items:
+            break
+
+        if page == 1:
+            # Getting Totals to calculate the progress bar
+            if reached == True:
+                items_total = out["total_items"]
+            else:
+                try:
+                    items_total = int(opt)
+                except:
+                    items_total = 0
+        
+        # Reading items from the items
+        
+        for publication in items:
+
+            # skip dublicate publications. ( like when you edited
+            # a publication )
+            if publication["name"] in checked_publications:
+                continue
+            checked_publications.append(publication["name"])
+
+            current_item = current_item + 1
+
+            # If above the requested amount.
+            if current_item > items_total:
+                break
+            
+            # Draw progress bar                   
+            progress_bar(current_item, items_total, publication["name"])
+
+            # let's now get all the comments
+            claim_id = publication["claim_id"]
+
+            comment_page = 0
+            
+            while True:
+
+                comment_page = comment_page + 1
+                
+                cout = check_output(["flbry/lbrynet",
+                        "comment", "list", '--claim_id='+claim_id,
+                         '--page='+str(comment_page),
+                            '--page_size='+str(50),
+                            '--include_replies'])
+                
+                try:
+                    cout = json.loads(cout)
+                except:
+                    break
+
+                if "items" not in cout:
+                    break
+                for i in cout["items"]:
+
+                    # I want to add a few things into the comment data
+                    i["publication_url"] = publication["permanent_url"]
+                    i["publication_name"] = publication["name"]
+                    try:
+                        i["publication_title"] =  publication["value"]["title"]
+                    except:
+                        i["publication_title"] =  publication["name"]
+                        
+                    if i not in comments_cache:
+                        comments_cache.append(i)
+                    
+                
+    print()
+
+    # Let's sort the comments based on the time they were sent
+    comments_cache = sorted(comments_cache, key=lambda k: k['timestamp'], reverse=True) 
+
+    with open('inbox.json', 'w') as fp:
+            json.dump(comments_cache, fp , indent=4)
+
+
+
+    # Now that we have comments cached and ready. I can start actually showing
+    # them.
+
+    w, h = tsize()
+    page_size = (h-5)
+    page = 0
+
+    while True:
+
+        d = {"categories":["Tip LBC", "Comments", "Publication",  "Channel",  "Preview"],
+                          "size":[1,1,4,2,4],
+                          "data":[]}
+
+        items = []
+        
+        for n, i in enumerate(comments_cache):
+
+            startfrom = int( page * page_size )
+            endat     = int( startfrom + page_size )
+
+            if n in range(startfrom, endat):
+
+                items.append(i)
+                
+                preview = "---!Failed Loading comment---"
+                support = 0
+                replies = 0
+                where = "[some publication]"
+                bywho = "@Anonymous"
+                
+                try:
+                    comment = i["comment"]
+                    preview = comment.replace("\n", " ")
+                    where = i["publication_title"]
+                    support = i["support_amount"]
+                    bywho = i["channel_name"]
+                    replies = i["replies"]
+                    
+                except:
+                    pass
+                
+                d["data"].append([support, replies, where, bywho, preview])
+        table(d)
+
+        # Tell the user that he might want to load more
+        center("---type 'more' to load more---")
+        
+
+        # Making sure that we stop every time a new page is reached
+        c =  input(typing_dots())
+        if c == "more":
+            page = page +1
+            continue
+
+        try:
+            c = int(c)
+        except:
+            return
+
+        view(items[c])
+        c = input(typing_dots())
+            
+def update(i, args):
+    comment = i["comment"]
+
+    if len(args) > 1:
+        a = args.split()[0]
+
+        try:
+            text = open(a, "r")
+            text = text.read()
+        except:
+            text = open("/tmp/fastlbrycommentwriter.txt", "w")
+            text.write(comment)
+            text.close()
+
+            import os
+            os.system(a+" /tmp/fastlbrycommentwriter.txt")
+
+            center("Press Enter when the file is ready and saved.")
+            input()
+
+            text = open("/tmp/fastlbrycommentwriter.txt", "r")
+            text = text.read()
     else:
-        print("    "+clr["bdgr"]+clr["bold"]+wdth("Comment is sent.", 89)+clr["norm"])
+        print("Comment: "+comment)
+        text = input("Edited comment: ")
+
+    out = check_output(["flbry/lbrynet",
+                "comment", "update", "--comment_id="+i["comment_id"],
+                "--comment="+text])
+    out = json.loads(out)
+    try:
+        if out["message"].startswith("Couldn't find channel with channel_id"):
+            center("You cant' edit a comment that isn't yours", "bdrd")
+    except:
+        center("Comment edited!", "bdgr")

+ 127 - 0
flbry/following.py

@@ -0,0 +1,127 @@
+#####################################################################
+#                                                                   #
+#  THIS IS A SOURCE CODE FILE FROM A PROGRAM TO INTERACT WITH THE   #
+# LBRY PROTOCOL ( lbry.com ). IT WILL USE THE LBRY SDK ( lbrynet )  #
+# FROM THEIR REPOSITORY ( https://github.com/lbryio/lbry-sdk )      #
+# WHICH I GONNA PRESENT TO YOU AS A BINARY. SINCE I DID NOT DEVELOP #
+# IT AND I'M LAZY TO INTEGRATE IN A MORE SMART WAY. THE SOURCE CODE #
+# OF THE SDK IS AVAILABLE IN THE REPOSITORY MENTIONED ABOVE.        #
+#                                                                   #
+#      ALL THE CODE IN THIS REPOSITORY INCLUDING THIS FILE IS       #
+# (C) J.Y.Amihud and Other Contributors 2021. EXCEPT THE LBRY SDK.  #
+# YOU CAN USE THIS FILE AND ANY OTHER FILE IN THIS REPOSITORY UNDER #
+# THE TERMS OF GNU GENERAL PUBLIC LICENSE VERSION 3 OR ANY LATER    #
+# VERSION. TO FIND THE FULL TEXT OF THE LICENSE GO TO THE GNU.ORG   #
+# WEBSITE AT ( https://www.gnu.org/licenses/gpl-3.0.html ).         #
+#                                                                   #
+# THE LBRY SDK IS UNFORTUNATELY UNDER THE MIT LICENSE. IF YOU ARE   #
+# NOT INTENDING TO USE MY CODE AND JUST THE SDK. YOU CAN FIND IT ON #
+# THEIR OFFICIAL REPOSITORY ABOVE. THEIR LICENSE CHOICE DOES NOT    #
+# SPREAD ONTO THIS PROJECT. DON'T GET A FALSE ASSUMPTION THAT SINCE #
+# THEY USE A PUSH-OVER LICENSE, I GONNA DO THE SAME. I'M NOT.       #
+#                                                                   #
+# THE LICENSE CHOSEN FOR THIS PROJECT WILL PROTECT THE 4 ESSENTIAL  #
+# FREEDOMS OF THE USER FURTHER, BY NOT ALLOWING ANY WHO TO CHANGE   #
+# THE LICENSE AT WILL. SO NO PROPRIETARY SOFTWARE DEVELOPER COULD   #
+# TAKE THIS CODE AND MAKE THEIR USER-SUBJUGATING SOFTWARE FROM IT.  #
+#                                                                   #
+#####################################################################
+
+# Gets latest posts from subscriptions
+
+from subprocess import *
+import json
+from flbry.variables import *
+from flbry import url
+
+def following():
+    # Get the subscriptions
+    following = check_output(["flbry/lbrynet", "preference", "get"])
+    try:
+        following = json.loads(following)
+    except:
+        print("   Connect to LBRY first.")
+        return
+    following = following["shared"]["value"]["subscriptions"]
+
+    # Get enough results to fill the screen, then prompt user for more
+    w, h = tsize()
+
+    page_size = h - 5
+    page = 1
+
+    while True:
+        command = ["flbry/lbrynet", "claim", "search", "--page="+str(page), "--page_size="+str(page_size), "--order_by=release_time"]
+        # Gets each channel's ID and add it to the command
+        for i in following:
+            i = i.split("#", 1)[1]
+            command.append("--channel_ids="+i)
+
+        out = check_output(command)
+        out = json.loads(out)
+
+        try:
+            data_print = {"categories":["Type", "Channel", "Title"],
+                            "size":[1,2,5],
+                            "data":[]}
+
+            # List what we found
+            for n, i in enumerate(out["items"]):
+
+                title = "---!Failed Loading Title---"
+                ftype = "claim"
+                channel = "[anonymous]"
+    
+                try:
+                    try:
+                        title = i["value"]["title"]
+                    except:
+                        title = i['name']
+    
+                    try:
+                        ftype = what[i["value"]["stream_type"]]
+                    except:
+                        ftype = what[i["value_type"]]
+    
+                    try:
+                        channel = i["signing_channel"]["value"]["title"]
+                    except:
+                        channel = i["signing_channel"]["normalized_name"]
+                except:
+                    pass
+    
+    
+                data_print["data"].append([ftype, channel, title])
+    
+            table(data_print)
+            # Tell the user that he might want to load more
+            center("---type 'more' to load more---")
+            page = page +1
+
+        except Exception as e:
+            if "code" in out:
+                print("    Error code: ", out["code"]  )
+                if out["code"] == -32500:
+                    print("   SDK is still starting. Patience!")
+            else:
+                print("    Error :", e)
+            return
+
+        # Making sure that we stop every time a new page is reached
+        c =  input(typing_dots())
+        if c != "more":
+            break
+    try:
+        c = int(c)
+    except:
+        return
+
+    while True:
+        url.get(out["items"][c]["canonical_url"])
+        c =  input(typing_dots())
+        if not c:
+            break
+        try:
+            c = int(c)
+        except:
+            return

+ 0 - 0
flbry/lbrynet


+ 17 - 0
flbry/publish.py

@@ -226,6 +226,23 @@ def configure(file_path=""):
             "tags":[]
     }
 
+    # Completer thingy
+    complete([
+        "file",
+        "bid",
+        "price",
+        "url",
+        "title",
+        "license",
+        "channel",
+        "tags",
+        "description",
+        "help",
+        "save",
+        "load",
+        "publish"
+    ])
+    
     while True:
         # preview the data
         view_data(data)

+ 76 - 0
flbry/settings.py

@@ -0,0 +1,76 @@
+#####################################################################
+#                                                                   #
+#  THIS IS A SOURCE CODE FILE FROM A PROGRAM TO INTERACT WITH THE   #
+# LBRY PROTOCOL ( lbry.com ). IT WILL USE THE LBRY SDK ( lbrynet )  #
+# FROM THEIR REPOSITORY ( https://github.com/lbryio/lbry-sdk )      #
+# WHICH I GONNA PRESENT TO YOU AS A BINARY. SINCE I DID NOT DEVELOP #
+# IT AND I'M LAZY TO INTEGRATE IN A MORE SMART WAY. THE SOURCE CODE #
+# OF THE SDK IS AVAILABLE IN THE REPOSITORY MENTIONED ABOVE.        #
+#                                                                   #
+#      ALL THE CODE IN THIS REPOSITORY INCLUDING THIS FILE IS       #
+# (C) J.Y.Amihud and Other Contributors 2021. EXCEPT THE LBRY SDK.  #
+# YOU CAN USE THIS FILE AND ANY OTHER FILE IN THIS REPOSITORY UNDER #
+# THE TERMS OF GNU GENERAL PUBLIC LICENSE VERSION 3 OR ANY LATER    #
+# VERSION. TO FIND THE FULL TEXT OF THE LICENSE GO TO THE GNU.ORG   #
+# WEBSITE AT ( https://www.gnu.org/licenses/gpl-3.0.html ).         #
+#                                                                   #
+# THE LBRY SDK IS UNFORTUNATELY UNDER THE MIT LICENSE. IF YOU ARE   #
+# NOT INTENDING TO USE MY CODE AND JUST THE SDK. YOU CAN FIND IT ON #
+# THEIR OFFICIAL REPOSITORY ABOVE. THEIR LICENSE CHOICE DOES NOT    #
+# SPREAD ONTO THIS PROJECT. DON'T GET A FALSE ASSUMPTION THAT SINCE #
+# THEY USE A PUSH-OVER LICENSE, I GONNA DO THE SAME. I'M NOT.       #
+#                                                                   #
+# THE LICENSE CHOSEN FOR THIS PROJECT WILL PROTECT THE 4 ESSENTIAL  #
+# FREEDOMS OF THE USER FURTHER, BY NOT ALLOWING ANY WHO TO CHANGE   #
+# THE LICENSE AT WILL. SO NO PROPRIETARY SOFTWARE DEVELOPER COULD   #
+# TAKE THIS CODE AND MAKE THEIR USER-SUBJUGATING SOFTWARE FROM IT.  #
+#                                                                   #
+#####################################################################
+
+import os
+from flbry.variables import *
+
+# This file will manage settings / installation and stuff like this.
+
+def get_settings_folder(flbry="flbry/"):
+
+    try:
+        data_dir = os.environ["XDG_DATA_HOME"] + flbry
+    except:
+        data_dir = os.path.expanduser("~/.local/share/"+flbry)
+
+    try:
+        os.makedirs(data_dir)
+    except:
+        pass
+
+    return data_dir
+    
+
+def install_desktop():
+
+    # This function will generate a .desktop file. And put it in
+    # ~/.local/
+
+    desktop = """[Desktop Entry]
+Name=FastLBRY Terminal
+GenericName=LBRY client
+Path="""+os.getcwd()+"""
+Exec=python3 run.py
+Icon="""+os.getcwd()+"""/icon.png
+Terminal=true
+Type=Application
+Categories=Network;AudioVideo"""
+
+    # Now we need to get and place it in the right place
+
+    desktop_file = get_settings_folder("applications/")+"FastLRBY-terminal.desktop"
+    
+    if not os.path.exists(desktop_file):
+        try:
+            o = open(desktop_file, "w")
+            o.write(desktop)
+            o.close()
+            center("Installed in Applications Menu", "bdgr")
+        except:
+            center("Installing in Applications Menu failed", "bdrd")

+ 62 - 13
flbry/url.py

@@ -165,7 +165,12 @@ def get(url=""):
     try:    
         # This prints out the title
         d["data"][0].append(out["signing_channel"]["name"])
-        d["data"][0].append(out["signing_channel"]["value"]["title"])
+        title = "[no title]"
+        try:
+            title = out["signing_channel"]["value"]["title"]
+        except:
+            pass
+        d["data"][0].append(title)
     except:
         d["data"][0] = []
         d["data"][0].append("[no url]")
@@ -221,11 +226,28 @@ def get(url=""):
     # Some things are too big to output like this in the terminal
     # so for them I want the user to type a command.
 
-    center("--- for publication commands list type help --- ")
+    center("--- for publication commands list type 'help' --- ")
 
     # So we are going to start a new while loop here. IK crazy.
     # this one will handle all the commands associated with the
     # currently selected publication.
+
+    # Completer thingy
+    complete([
+        "help",
+        "link",
+        "id",
+        "web",
+        "description",
+        "read",
+        "channel",
+        "comments",
+        "reply",
+        "open",
+        "play",
+        "save",
+        "rss"
+    ])
     
     while True:
         c =  input(typing_dots())
@@ -236,16 +258,26 @@ def get(url=""):
         elif c == "help":
             markdown.draw("help/url.md", "Publication Help")
             
-        elif c == "https":
-            Popen(['xdg-open',
-                   url.replace("lbry://", "https://spee.ch/").replace("#", ":").replace("(", "%28").replace(")", "%29")], 
-                              stdout=DEVNULL,
-                              stderr=STDOUT)
-        elif c == "odysee":
-            Popen(['xdg-open',
-                   url.replace("lbry://", "https://odysee.com/").replace("#", ":").replace("(", "%28").replace(")", "%29")], 
-                              stdout=DEVNULL,
-                              stderr=STDOUT)
+        elif c == "web":
+            d = {"categories":["Name", "URL", "Maintainer", "Interface"],
+                 "size":[1,2,1,1],
+                 "data":web_instances}
+            table(d)
+            center("")
+
+            # Choose an instance
+            which = input(typing_dots())
+            try:
+                print("    "+url.replace("lbry://", web_instances[int(which)][1]))
+            except:
+                print("    "+url.replace("lbry://", web_instances[0][1]))
+
+        elif c == "link":
+            print("   "+url)
+
+        elif c == "id":
+            print("   "+out["claim_id"])
+            
         elif c.startswith("open"):
 
             # Selecting the software command in a smart way
@@ -329,7 +361,10 @@ def get(url=""):
             if out["value_type"] == "channel":
                 channel.simple(url)
             else:
-                channel.simple(out["signing_channel"]["canonical_url"].replace("lbry://",""))
+                try:
+                    channel.simple(out["signing_channel"]["canonical_url"].replace("lbry://",""))
+                except:
+                    center("Publication is anonymous", "bdrd")
 
         elif c == "comments":
             comments.list(out["claim_id"], url)
@@ -337,3 +372,17 @@ def get(url=""):
         elif c.startswith("reply"):
             c = c + ' '
             comments.post(out["claim_id"], c[c.find(" "):])
+
+        elif c == "rss":
+            if out["value_type"] == "channel":
+                url = out["short_url"].replace("#", ":")
+                if url.startswith("lbry://"):
+                    url = url.split("lbry://", 1)[1]
+                print("   https://odysee.com/$/rss/"+url)
+            else:
+                try:
+                    url = out["signing_channel"]["short_url"].replace("#", ":")
+                    url = url.split("lbry://", 1)[1]
+                    print("   https://odysee.com/$/rss/"+url)
+                except:
+                    center("Publication is anonymous!", "bdrd")

+ 0 - 0
flbry/variables.py


Some files were not shown because too many files changed in this diff