Ver a proveniência

Added indexing and numbering

master
madiwka3 há 4 anos
ascendente
cometimento
71d6109bda
3 ficheiros alterados com 18 adições e 7 eliminações
  1. +5
    -5
      open.py
  2. +10
    -0
      readme.md
  3. +3
    -2
      spotitube.sh

+ 5
- 5
open.py Ver ficheiro

@@ -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 Ver ficheiro

@@ -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 Ver ficheiro

@@ -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

Carregando…
Cancelar
Guardar