mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 01:01:27 +00:00
Compare commits
3 commits
92a52dd2b8
...
89a8133de7
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | 89a8133de7 | ||
localhost_frssoft | 61265cceb8 | ||
localhost_frssoft | a9b3fddffe |
16
README.md
16
README.md
|
@ -1,6 +1,20 @@
|
|||
# funkwlplay
|
||||
|
||||
basic functional for create playlist tracks. Be simple as possible. No implement player and tui. Just bare cli solution.
|
||||
basic functional for create playlist tracks. Be simple as possible. No implement player and tui. Just bare cli solution.
|
||||
Random powered, good luck :3
|
||||
|
||||
Example usage:
|
||||
```
|
||||
./funkwlplay.py # just get random tracks from instances
|
||||
|
||||
./funkwlplay.py -s 'dance with the dead' # search on instances
|
||||
|
||||
./funkwlplay.py -t house # search tag house on instances
|
||||
|
||||
./funkwlplay.py -r 1 -d 10 -i funk.deko.cloud # get 10 pages random tracks from instance
|
||||
|
||||
$YOUR_FAVORITE_PLAYER playlist.m3u8 # just plays tracks. Remember at this moment playlist will be rewriten after every call ./funkwlplay.py
|
||||
```
|
||||
|
||||
[1]**Warning:** may content _unofficial instances_
|
||||
**Warning 2:** This software not userfriendly. Maybe developerfriendly.
|
||||
|
|
|
@ -40,7 +40,6 @@ def filter_tracks(tracks):
|
|||
except:
|
||||
return 0
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
|
||||
before = len(tracks)
|
||||
res = [executor.submit(remove_unreach_tracks, track) for track in tracks]
|
||||
concurrent.futures.wait(res)
|
||||
avalaible = []
|
||||
|
@ -49,8 +48,6 @@ def filter_tracks(tracks):
|
|||
if is_avalaible == 1:
|
||||
avalaible.append(track)
|
||||
tracks = avalaible
|
||||
after = before - len(tracks)
|
||||
print(f'-{after} unreach tracks')
|
||||
|
||||
Path('filter_tags').touch()
|
||||
Path('filter_artists').touch()
|
||||
|
@ -63,7 +60,7 @@ def filter_tracks(tracks):
|
|||
|
||||
with open('filter_raw_urls') as raw_urls_file:
|
||||
block_raw_urls = raw_urls_file.read().strip().split('\n')
|
||||
|
||||
filtred_tracks = []
|
||||
for i in tracks:
|
||||
if [tag.lower() for tag in i['tags']] in block_tags:
|
||||
continue
|
||||
|
@ -71,8 +68,8 @@ def filter_tracks(tracks):
|
|||
continue
|
||||
if i['listen_url'].lower() in block_raw_urls:
|
||||
continue
|
||||
tracks_stor.append(i)
|
||||
|
||||
filtred_tracks.append(i)
|
||||
return filtred_tracks
|
||||
|
||||
|
||||
def search_tracks_on_instance(instance, tag='', query='', recursion=args.recursion):
|
||||
|
@ -111,10 +108,16 @@ with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
|
|||
for idx, instance in enumerate(instances):
|
||||
try:
|
||||
tracks = res[idx].result()
|
||||
filter_tracks(tracks['results'])
|
||||
before_filter = len(tracks['results'])
|
||||
filtred_tracks = filter_tracks(tracks['results'])
|
||||
after_filter = before_filter - len(filtred_tracks)
|
||||
print(f'{after_filter} tracks filtred on {instance}')
|
||||
tracks_stor = filtred_tracks
|
||||
except Exception as E:
|
||||
print(E)
|
||||
for track in tracks_stor:
|
||||
artist, album, title, play_url = track['artist']['name'], track['album']['title'], track['title'], track['listen_url']
|
||||
playlist_files.append(f'#EXTINF:-1,{artist} - {album} - {title}\n{play_url}')
|
||||
artist, album, title, play_url, track_duration = track['artist']['name'], track['album']['title'], track['title'], track['listen_url'], track.get('duration')
|
||||
if not track_duration:
|
||||
track_duration = -1
|
||||
playlist_files.append(f'#EXTINF:{track_duration},{artist} - {album} - {title}\n{play_url}')
|
||||
create_playlist_file(playlist_files)
|
||||
|
|
Loading…
Reference in a new issue