text stringlengths 1 93.6k |
|---|
continue
|
# Here is the unpausing code:
|
oldTitle = "" # We want to update the "Now playing" message
|
# This is only really visible for stations which dont send song titles
|
print(
|
"\r" + " "*38 + "\r" +
|
colors.YELLOW + "-> Playback restarted!" + colors.ENDC, end="")
|
continue # ...with the "While True:" loop above!
|
# A second Ctrl+C ends the program
|
except KeyboardInterrupt:
|
# To make your bash prompt not mess up :) ~(>.<)~ a man of culture
|
print("")
|
# Stop playbock
|
stream_player.stop()
|
adblock_player.stop()
|
sys.exit()
|
# Our main function. This runs at program start.
|
def main():
|
# This disables Ctrl+Z while the script is running (only on Linux)
|
if sys.platform != "win32":
|
signal.signal(signal.SIGTSTP, signal.SIG_IGN)
|
# TODO: Look into "autoreset=True", rename arguments to better names!
|
# Progress: Arguments
|
# Initalize colorama
|
colorama.init()
|
parser = argparse.ArgumentParser(description="Play your favorite radio station from the terminal")
|
parser.add_argument("-p", "--print",
|
action="store_true",
|
help="print a list of all stations in the local database")
|
# This way, "station" can be a required positional argument,
|
# but only if "--print" is not given. Also, we need to add these parameters if the user called "-h".
|
if not(any(elem in sys.argv for elem in ["-p", "--print"])) or any(elem in sys.argv for elem in ["-h", "--help"]):
|
parser.add_argument("-l", "--local",
|
action="store_true",
|
help="only use local station database for URL lookup")
|
parser.add_argument("-d", "--download",
|
action="store_true",
|
help="save stream to files instead of playing")
|
parser.add_argument("-s", "--split",
|
action="store_true",
|
help="do not split files saved with --download")
|
parser.add_argument("station",
|
type=str,
|
help="name of station to play, checked on TuneIn if unknown")
|
parser.add_argument("volume",
|
type=int, default=100, nargs='?',
|
help="playback volume (default: 100)")
|
args = parser.parse_args()
|
# Our actions are show_stations(), download_station(), and play_station().
|
# We sys.exit() at the end of each of these.
|
if args.print:
|
show_stations()
|
if args.station:
|
station_data = initalize_radio(args.station, args.local)
|
if args.download:
|
download.download_station(station_data[0], station_data[1], args.split)
|
play_station(station_data[0], station_data[1], args.volume)
|
if __name__ == "__main__":
|
main()
|
# <FILESEP>
|
#!/usr/bin/python3
|
# Tool Name :- MyServer
|
# Author :- Rajkumar Dusad
|
# Date :- 2021/26/7
|
import sys, os
|
from time import sleep
|
from core.system import *
|
from modules.logo import *
|
from modules.menu import *
|
class inst:
|
def chk_sys(self):
|
if "linux" in sys.platform or "linux2" in sys.platform:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.