Compare commits

..

No commits in common. "a99cd9fd577f30f9ae1831ff4177807fdd0bddf5" and "2359ffe9220972bafcd8b8ea3ecfc61ceac30170" have entirely different histories.

6 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# funkwlmpv
# funkwhale-cli
Just for fun. A simple TUI media player for FunkWhale instances. Writen on python
Features:
@ -21,7 +21,7 @@ Python dependencies:
Optional: brotli
### About cache folder
funkwlmpv has to cache tracks before playing (default disabled "enable_persistent_cache"). Cache is persistent and you should manage it manually because the (script/program) can't clean it automatically.
funkwhale-cli has to cache tracks before playing (default disabled "enable_persistent_cache"). Cache is persistent and you should manage it manually because the (script/program) can't clean it automatically.
Cache structure: cache/domain.tld/[track uuid]
You can play tracks offline, example: mpv --shuffle cache/*/*
cache_helper.sh - it might be useful for compression cache (lossy: vorbis 128 kbps, no thumbnail)

View File

@ -94,7 +94,7 @@ def main():
print(f'''
If You want sign in, please visit:
https://{current_instance.instance}/settings/applications/new
And fill Name funkwlmpv
And fill Name funkwhale-cli
Scopes:
Read | Write (optional):
write:libraries

View File

@ -32,7 +32,7 @@ class current_instance:
s = requests.Session()
s.headers.update({
"Accept-encoding": 'gzip, br, deflate',
"User-Agent": "funkwlmpv/latest-commit; +https://git.phreedom.club/localhost_frssoft/funkwlmpv"
"User-Agent": "funkwhale-cli/latest-commit; +https://git.phreedom.club/localhost_frssoft/funkwhale-cli"
})
instance = get_config('instance')
token = auth.get(instance)

View File

@ -77,7 +77,7 @@ def fetch_instances_nodeinfo_and_avalaibility(instances):
return requests.get('https://' + instance + '/api/v1/instance/nodeinfo/2.0/',
headers={
'Accept-Encoding': 'gzip, brotli, deflate',
'User-Agent': 'funkwlmpv/latest-commit; +https://git.phreedom.club/localhost_frssoft/funkwlmpv'},
'User-Agent': 'funkwhale-cli/latest-commit; +https://git.phreedom.club/localhost_frssoft/funkwhale-cli'},
timeout=10).json()
with concurrent.futures.ThreadPoolExecutor() as executor: # optimally defined number of threads

View File

@ -1,6 +1,6 @@
from src.fw_api import get_favorires_tracks, get_recently_listened, get_audio_file
from src.fw_api_hints import hint_scope
from src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage, play_track
from src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage
from pyfzf.pyfzf import FzfPrompt
from loguru import logger
@ -54,3 +54,14 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
else:
play_track(track=tracks_results[int(
select[0].split('.', 1)[0])]['track'])
def play_track(track, multi=False):
listen_url = get_audio_file(track['listen_url'], True)
player_fw_storage.storage[track_url_to_uuid(listen_url)] = track
if multi:
player.loadfile(listen_url, 'append-play')
else:
player.loadfile(listen_url, 'append-play')
track_name = track.get('title')
player_menu(f"{track_name} playing...", player_fw_storage.storage)

View File

@ -23,6 +23,7 @@ player.ytdl = False # Prevent attempts load track with yt-dlp
player.volume = get_config('mpv_volume')
player.prefetch_playlist = get_config('prefetch_playlist')
show_like_button = get_config('show_like_button')
track_activity_history = get_config('track_activity_history')
share_to_fediverse_token = get_config('share_to_fediverse_token')
share_to_fediverse_instance = get_config('share_to_fediverse_instance')
shuffle = False
@ -69,7 +70,7 @@ def send_listen_activity():
tags = ' '.join(tags)
if tags == []:
tags = ''
status_obj = {'spoiler_text': 'funkwlmpv music share',
status_obj = {'spoiler_text': 'funkwhale-cli music share',
'visibility': 'unlisted',
'status': f'🎧 {artist} - {album} - {title}\n{fid}\n#NowPlaying {tags}'}
requests.post(f'https://{share_to_fediverse_instance}/api/v1/statuses',