Closed jojo-monk closed 5 years ago
Hi
That you can do. What is your use case? :)
As for controlling Spotify (through cli), you can use this code: https://github.com/bjarneo/Pytify/blob/master/pytify/cli.py#L15, then use next/prev/stop etc like this: https://github.com/bjarneo/Pytify/blob/master/pytify/cli.py#L45
However, if you want to communicate with the spotify API, I would recommend this lib: https://spotipy.readthedocs.io/en/latest/
Thanks
I would like to write a simple recorder for spotify. spotipy is good but it can play only 30 seconds.
but i don't understand, if i try this for example :
`import pytify from pytify import cli
spot = cli.App() spot.play_pause()`
I get this :
`pytify 3.5.2 [https://github.com/bjarneo/Pytify] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/interface.py", line 383, in run with self.input.raw_mode(): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prompt_toolkit/input.py", line 69, in raw_mode return raw_mode(self.stdin.fileno()) io.UnsupportedOperation: fileno
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Volumes/Données/jojo/python/test pytify.py", line 4, in
excuse me for my bad english, and my beginner's questions ;)
@jojo-monk could you try to implement it by doing this?
from pytify.strategy import get_pytify_class_by_platform
spot = get_pytify_class_by_platform()()
spot.play_pause()
Yes, it works, thanks.
another question : is there a method to get the duration of a song with pytify ?
We don't have any logic for this I am afraid. However, if you have a look at this line: https://github.com/bjarneo/Pytify/blob/master/pytify/linux.py#L12 it gets the metadata from the current song. It should contain the length. Haven't tried it yet.
This line https://github.com/bjarneo/Pytify/blob/master/pytify/linux.py#L31 get the current playing
Hello, I would like to use pytify in a python code, but what are the methods, and functions ?
thanks