Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: for intelligent play list #4

Open
ghost opened this issue Apr 14, 2015 · 3 comments
Open

feature request: for intelligent play list #4

ghost opened this issue Apr 14, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Apr 14, 2015

Sorry if I don't put this feature request in the right place.

I would like new feature for intelligent play list.

Consider for example 3 play list (list A, B, C)
I would like to make a intelligent play list like that:
-max 10 tracks
-4 random tracks from plalist A
-3 random tracks from plalist B
-3 random tracks from plalist C
-and never twice same track

Thank you for this great soft!

@virtuald
Copy link
Member

This sounds like a niche usecase, and I'm not particularly interested in implementing it myself. However, if someone else wants to implement it I'll gladly accept a pull request.

@sjohannes
Copy link
Member

If this is something you won't do very often, you can run code such as the following in the IPython Console plugin:

import random
import xl.playlist

playlists = ["Playlist A", "Playlist B", "Playlist C"]
take_from_playlists = [4, 3, 3]

playlists = map(exaile.playlists.get_playlist, playlists)  # Get the named playlists
playlists = map(list, playlists)  # Copy as lists
playlists = map(random.shuffle, playlists)  # Shuffle each list

combined = xl.playlist.Playlist("Combined")
combined_set = set()  # To check for duplicates
for pl, wanted in zip(playlists, take_from_playlists):
    while wanted:
        t = pl.pop()
        if t not in combined_set:
            combined.append(t)
            combined_set.add(t)
            wanted -= 1
exaile.playlists.save_playlist(combined, True)

I haven't tested this code, but it should do what you describe and save the result in a new playlist named "Combined".

@ghost
Copy link
Author

ghost commented Jun 16, 2015

Thanks, but this is something I'll like to do every days! :D
Also I got Exaile 3.4.4 and the python modul looks broken:
http://www.zimagez.com/zimage/capturedcran-16062015-145342.php

@virtuald virtuald transferred this issue from exaile/exaile Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants