123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- #####################################################################
- # #
- # 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. #
- # #
- #####################################################################
- # Preparing the executable of lbrynet to be running. If we don't that
- # there will be a nasty error of permission being denied.
- import os
- os.system("chmod u+x flbry/lbrynet")
- from flbry.variables import *
- # A welcome logo.
- print(" "+clr["bdma"]+wdth(" ",89)+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" _____ ____ ____"+wdth(" ",27)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" | | | \ | \ | |"+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" | ___ _______ | | | | | \ /"+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" |___ /\ | | | |____/ |____/ \ / "+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" | / \ |___ | | | \ | \ \ / "+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" | /____\ | | | | | | | | "+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" | / \ ___| | |_____ |____/ | | | "+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+clr["bold"]+wdth(" ",16)+" The Terminal Client "+wdth(" ",17)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bdma"]+" "+clr["bdbu"]+wdth(" ",87)+clr["bdma"]+" "+clr["norm"])
- print(" "+clr["bold"]+clr["bdma"],
- " ---type help to see list of features---",
- wdth(" ",24)+clr["norm"])
- # Importing all kinds of other things needed for the operations
- from flbry import connect
- from flbry import search
- from flbry import channel
- from flbry import wallet
- from flbry import uploads
- from flbry import list_files
- # Now we gonna start the main loop. It will give the user to input
- # any function. And when the function is executed, it will give it
- # again. Forever. Until the user exits.
- while True:
- command = input(" : ") # the : will be the presented function
- if command == "exit":
- connect.stop()
- break # breaks the while True: loop
-
- elif command == "quit":
- print(" Quit does not disconnect the SDK!")
- print(" To disconnet use exit or disconnect.")
- break
-
- elif command == "help":
- print("""
- This is the help menu of the FastLBRY. It will list the currently
- implemented features. If you want to help us develop more features
- or help with understanding the LBRY SDK. You can contact us either
- in the repository or using the Matrix chat.
- -------------------| HELP AND CONTRIBUTION |----------------------
- help - Returns this help message.
- exit - Exits the software.
- quit - Exit the program without disconnecting. Used for
- testing new code changes.
- matrix - Gives the Matrix url to join the official room.
- repository - Gives the repository url for contributors.
- report - Gives the url of the issue tracker.
- license - Returns the legal code of the license.
-
- -------------------| SIMPLE LBRY COMMANDS |----------------------
- connect - Will connect to the LBRY network
- disconnect - Will disconnect from the LBRY network
- search - Give you an ability to search on LBRY
- channel - Gives a list of publications from a
- specific LBRY channel. Use lbry link to
- the channel and not the title.
- ------------------| ACCOUNT MANAGEMENT |-----------------------
- login - Logic into LBRY
- history - See your download history.
- uploads - See your upload history.
- wallet - See wallet history.
- """)
- # HELP AND CONTRIBUTION FUNCTIONS
-
- elif command == "matrix":
- print(" #FastLBRY:matrix.org")
- elif command == "repository":
- print(" https://notabug.org/jyamihud/FastLBRY-terminal")
- elif command == "report":
- print(" https://notabug.org/jyamihud/FastLBRY-terminal/issues")
- elif command == "license":
- l = open("LICENSE", "r")
- print(l.read())
- # LBRY COMMANDS
- elif command == "connect":
- connect.start()
-
- elif command == "disconnect":
- connect.stop()
- elif command == "history":
- list_files.downloaded()
- elif command.startswith("search"):
- if " " in command:
- search.simple(command[command.find(" ")+1:])
- else:
- search.simple()
- elif command.startswith("channel"):
- if " " in command:
- channel.simple(command[command.find(" ")+1:])
- else:
- channel.simple()
-
- ###### WALLET ######
- elif command == "login":
- print("""
- Currently FastLBRY login is not yet implement. But it is
- possible to login. While hacking on the LBRY SDK ( lbrynet )
- I realized that it shares account information with any
- lbrynet running on the same system. So if you launch the
- LBRY Desktop app ones to log in, it will spread the login
- to all the other SDKs including FastLBRY.
- As soon as I will figure out how to make a login. I will
- implement it here, and this message will disappear.
- For now. Get LBRY Desktop ( lbry.com ) login there. And
- come back to here. You will be logged in.
- """)
-
- elif command == "wallet":
- wallet.history()
- elif command == "uploads":
- uploads.simple()
|