Quellcode durchsuchen

Added indexing and numbering

master
madiwka3 vor 4 Jahren
Ursprung
Commit
71d6109bda
3 geänderte Dateien mit 18 neuen und 7 gelöschten Zeilen
  1. +5
    -5
      open.py
  2. +10
    -0
      readme.md
  3. +3
    -2
      spotitube.sh

+ 5
- 5
open.py Datei anzeigen

@@ -16,11 +16,11 @@ def main(argv):
sys.exit()
elif opt in ("-i", "--ifile"):
inputfile = arg
results = YoutubeSearch(inputfile, max_results=10).to_dict()
ans = 'https://youtu.be/' + results[0]['url_suffix'][9:]
print(ans)
elif opt in ("-o", "--ifile"):
numberfile = arg
results = YoutubeSearch(inputfile, max_results=int(numberfile)).to_dict()
ans = 'https://youtu.be/' + results[int(numberfile)-1]['url_suffix'][9:]
print(ans)

if __name__ == "__main__":
main(sys.argv[1:])

+ 10
- 0
readme.md Datei anzeigen

@@ -35,4 +35,14 @@ All you have to do is launch spotitube.sh and give it a string argument with the
./spotitube.sh "Song name"
```

If you want to get a specific index of a result, just type that index as a second argument:

```shell
./spotitube.sh "Song name" 3
```
This will result in:
```
Searching for result #3 in Song name...
```

Enjoy your music!

+ 3
- 2
spotitube.sh Datei anzeigen

@@ -1,4 +1,5 @@
va=$(python3 open.py -i "$1")
echo $1
echo "Searching for result #${2:-1} in $1..."
va=$(python3 open.py -i "$1" -o "${2:-1}")

echo "Opening $va"
mpv --no-video $va

Laden…
Abbrechen
Speichern