Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Library Tree Discussion (Read 127995 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Library Tree Discussion

Reply #600
^ I've noticed after changing the Options > Behavior tab > Playlist Sort Order box, that you have to reload the panel for changes to take effect correctly.

If that does not work...

Are track filenames starting with %discnumber%.%tracknumber% ? (for %path_sort% to sort correctly)

What happens if you put a custom sort order in that box, like -

Code: [Select]
%album artist%|%date%|%album%|%discnumber%|%tracknumber%|%title%

Re: Library Tree Discussion

Reply #601
that you have to reload the panel for changes to take effect correctly.
I filled in [ %path_sort%] and restarted fb2k to take effect.Or as you say, reloaded panels can work.
For this sort, click OK in the settings panel does not take effect immediately, Wilb, is there any way to improve?

Re: Library Tree Discussion

Reply #602
Happens the same to me with .CUE of FLAC or APE files, shows duplicated. I use the component "Cue Fixer", so in the playlists the albums shows correctly.
Cue Fixer don't work with library :(  (only with playlist view).  Any ideas on how to find a way out?
X
I will try add additional command to callbacks.js:
function on_playlist_items_added(playlistIndex) {
.........
window.Reload();}
.
 It works, but the panels refresh 2 times and blinks. Maybe someone has some better ideas?

Re: Library Tree Discussion

Reply #603
Not an easy task but if you were prepared to rename your files something like...

blah.cue
blah.cue.flac

You could prevent *.cue.flac from being indexed at File>Preferences>Media Library>File types>Exclude.

edit: references inside cue files would obviously need updating. What fun.

Re: Library Tree Discussion

Reply #604
Not an easy task but if you were prepared to rename your files..
I don't want to rename, because all files are seeding in "transmission")
Maybe I can add additional update command in the right place in the code?

Re: Library Tree Discussion

Reply #605
Quote
Maybe I can add additional update command in the right place in the code?
I found a solution!
1. I made a clone of the original package.
2. I added to populate.js in the section
load(list, isArray, add, autoPlay, def_pl, insert) {....}
creating an additional playlist with name "Library folder cache"
Code: [Select]
load(list, isArray, add, autoPlay, def_pl, insert) {
let np_item = -1;
let pid = -1;
const pl_stnd = ppt.libPlaylist.replace(/%view_name%/i, panel.viewName);
let pl_stnd_idx = plman.FindOrCreatePlaylist(pl_stnd, true);
        let cache_2nd_pl = plman.FindOrCreatePlaylist("Library folder cache", true);//my solution

if (!def_pl && plman.ActivePlaylist != -1) pl_stnd_idx = plman.ActivePlaylist;
else if (ppt.activateOnChange) plman.ActivePlaylist = pl_stnd_idx;


if (autoPlay == 4 && plman.PlaylistItemCount(pl_stnd_idx) || autoPlay == 3 && fb.IsPlaying) {
autoPlay = false;
add = true;
}
const items = isArray ? this.getHandleList() : list.Clone();

this.sortIfNeeded(items);
this.selList = items.Clone();
this.selection_holder.SetSelection(this.selList);
const plnIsValid = pl_stnd_idx != -1 && pl_stnd_idx < plman.PlaylistCount;
const pllockRemoveOrAdd = plnIsValid ? plman.GetPlaylistLockedActions(pl_stnd_idx).includes('RemoveItems') || plman.GetPlaylistLockedActions(pl_stnd_idx).includes('ReplaceItems') || plman.GetPlaylistLockedActions(pl_stnd_idx).includes('AddItems') : false;
if (!add && pllockRemoveOrAdd) return;
if (fb.IsPlaying && !add) {
if (ppt.actionMode == 1) {
const pl_playing = `${ppt.libPlaylist} (playing)`;
const pl_playing_idx = plman.FindOrCreatePlaylist(pl_playing, false);
if (plman.PlayingPlaylist == pl_stnd_idx) {
plman.RenamePlaylist(pl_stnd_idx, pl_playing);
plman.RenamePlaylist(pl_playing_idx, pl_stnd);
plman.SetPlaylistSelection(pl_playing_idx, $.range(0, plman.PlaylistItemCount(pl_playing_idx) - 1), true);
plman.RemovePlaylistSelection(pl_playing_idx, false);
plman.InsertPlaylistItems(pl_playing_idx, 0, items, false);
plman.MovePlaylist(pl_playing_idx, pl_stnd_idx);
plman.MovePlaylist(pl_stnd_idx + 1, pl_playing_idx);
                    plman.SetPlaylistSelection(pl_stnd_idx, $.range(0, plman.PlaylistItemCount(pl_stnd_idx) - 1), true);//my solution
                    plman.RemovePlaylistSelection(pl_stnd_idx, false);//my solution
                    plman.InsertPlaylistItems(pl_stnd_idx, 0, items, false);//my solution
                    plman.ClearPlaylist(cache_2nd_pl);//my solution
        plman.InsertPlaylistItems(cache_2nd_pl, 0, items);//my solution
                   
} else {
plman.SetPlaylistSelection(pl_stnd_idx, $.range(0, plman.PlaylistItemCount(pl_stnd_idx) - 1), true);
                    plman.RemovePlaylistSelection(pl_stnd_idx, false);
                    plman.InsertPlaylistItems(pl_stnd_idx, 0, items, false);
                 plman.ClearPlaylist(cache_2nd_pl);//my solution
     plman.InsertPlaylistItems(cache_2nd_pl, 0, items);//my solution
                   
}

plman.ActivePlaylist = pl_stnd_idx;
            
} else if (fb.GetNowPlaying()) {
np_item = items.Find(fb.GetNowPlaying());
let pl_chk = true;
let np;
if (np_item != -1) {
np = plman.GetPlayingItemLocation();
if (np.IsValid) {
if (np.PlaylistIndex != pl_stnd_idx) pl_chk = false;
else pid = np.PlaylistItemIndex;
}
if (pl_chk && pid == -1 && items.Count < 5000) {
if (ui.dui) plman.SetActivePlaylistContext();
const start = Date.now();
for (let i = 0; i < 20; i++) {
if (Date.now() - start > 300) break;
fb.RunMainMenuCommand('Edit/Undo');
np = plman.GetPlayingItemLocation();
if (np.IsValid) {
pid = np.PlaylistItemIndex;
if (pid != -1) break;
}
}
}
}
if (pid != -1) {
plman.ClearPlaylistSelection(pl_stnd_idx);
                    plman.ClearPlaylistSelection(cache_2nd_pl);//my solution
plman.SetPlaylistSelectionSingle(pl_stnd_idx, pid, true);
                    plman.SetPlaylistSelectionSingle(cache_2nd_pl, pid, true);//my solution
plman.RemovePlaylistSelection(pl_stnd_idx, true);
                    plman.RemovePlaylistSelection(cache_2nd_pl, true);//my solution
const it = items.Clone();
items.RemoveRange(np_item, items.Count);
it.RemoveRange(0, np_item + 1);
if (plman.PlaylistItemCount(pl_stnd_idx) < 5000) plman.UndoBackup(pl_stnd_idx);
plman.InsertPlaylistItems(pl_stnd_idx, 0, items);
                    plman.InsertPlaylistItems(cache_2nd_pl, 0, items);//my solution
plman.InsertPlaylistItems(pl_stnd_idx, plman.PlaylistItemCount(pl_stnd_idx), it);
                    plman.InsertPlaylistItems(cache_2nd_pl, plman.PlaylistItemCount(pl_stnd_idx), it);//my solution
                   
} else {
if (plman.PlaylistItemCount(pl_stnd_idx) < 5000) plman.UndoBackup(pl_stnd_idx);
plman.ClearPlaylist(pl_stnd_idx);
                    plman.ClearPlaylist(cache_2nd_pl);//my solution
plman.InsertPlaylistItems(pl_stnd_idx, 0, items);
plman.InsertPlaylistItems(cache_2nd_pl, 0, items);//my solution 
                 
}
}
} else if (!add) {
if (plman.PlaylistItemCount(pl_stnd_idx) < 5000) plman.UndoBackup(pl_stnd_idx);
plman.ClearPlaylist(pl_stnd_idx);
            plman.ClearPlaylist(cache_2nd_pl);//my solution
plman.InsertPlaylistItems(pl_stnd_idx, 0, items);
            plman.InsertPlaylistItems(cache_2nd_pl, 0, items);//my solution
plman.SetPlaylistFocusItem(pl_stnd_idx, 0);
//plman.SetPlaylistFocusItem(cache_2nd_pl, 0);//my solution

} else {
if (plman.PlaylistItemCount(pl_stnd_idx) < 5000) plman.UndoBackup(pl_stnd_idx);
plman.InsertPlaylistItems(pl_stnd_idx, !insert ? plman.PlaylistItemCount(pl_stnd_idx) : plman.GetPlaylistFocusItemIndex(pl_stnd_idx), items, true);
            plman.InsertPlaylistItems(cache_2nd_pl, !insert ? plman.PlaylistItemCount(pl_stnd_idx) : plman.GetPlaylistFocusItemIndex(pl_stnd_idx), items, true);//my solution
const f_ix = !insert || plman.GetPlaylistFocusItemIndex(pl_stnd_idx) == -1 ? plman.PlaylistItemCount(pl_stnd_idx) - items.Count : plman.GetPlaylistFocusItemIndex(pl_stnd_idx) - items.Count;
plman.SetPlaylistFocusItem(pl_stnd_idx, f_ix);
plman.EnsurePlaylistItemVisible(pl_stnd_idx, f_ix);

         
}
if (autoPlay) {
const c = (plman.PlaybackOrder == 3 || plman.PlaybackOrder == 4) ? Math.ceil(plman.PlaylistItemCount(pl_stnd_idx) * Math.random() - 1) : 0;
plman.ExecutePlaylistDefaultAction(pl_stnd_idx, c);
}
}
3. In the 1st panel I added a moded panel: source=library (view by folder structure), in behaviour tab set default playlist=Library artist cache (mode=browser).
4. In the 2nd panel - original panel: source=playlist "Library folder cache", in behaviour tab set default playlist="Library artist cache"  (mode=browser).
5. In the 3d panel - original panel: source=playlist "Library artist cache", in behaviour tab set default playlist="Library album cache"  (mode=browser).
Now Cue_fixer works fine with CUE & view by folder structure: clicking in the 1st panel creates 2 playlists: "Library folder cache" and Library artist cache. The 2nd panel is linked to the "Library folder cache" playlist. The 3rd panel is linked to the "Library artist cache" playlist. Clicking in the 3rd pane creates an independent "Library album cache" playlist.
X
P.s. Maybe the author will do a better job in the next update!

 

Re: Library Tree Discussion

Reply #606
I would appreciate to be able to identify the current branch in a secondary node.

In my scenario, I tag tracks with the birth place and, sometimes, the background of people (with the three-letter-code for Regor's World-Map) as follows:

%composer-iso3166% ("SVN; Slovenia" for Hugo Wolf)
%composer-iso3166-b% ("AUT; Austria" for Hugo Wolf)
%lyricist-iso3166% ("BRA; Brasil" for Alfredo Le Pera)
%lyricist-iso3166-b% ("ARG; Argentina" for Alfredo Le Pera)
%artist-iso3166% ("USA; United States of America" for Cathy Berberian)
%artist-iso3166-b% ("ARM; Armenia" for Cathy Berberian)
%group-iso3166% ("FRA; France" for Orange Blossom)
%group-iso3166-b% ("EGY; Egypt" for Orange Blossom)
%producer-iso3166% ("DZA; Algeria" for Hector Zazou)
%producer-iso3166-b% ("FRA; France" for Hector Zazou)

And I'm trying to set some branches:

Country
   Composers & Lyricists
   or
   Performers & Producers
      By their birthplace
      or
      By their background
         Name
            Album

but I'm loosing track of where I am in each step because tracks are indeed filtered including maybe a composer of the "right" country performed by an artist of a different one, so I'd need to know which is the right country to further filter tracks (so that these tracks get listed under the composer's name but the performer's name doesn't get highlighted as for the same nationality).

Spoiler (click to show/hide)

I've also tried to write all nodes at once, when parsing tracks in the topmost filter, but failed when going for successive criteria because all "¦" must be resolved before any "|", I guess:

%country%|'Composers & Lyricists'|'By their birthplace'|%composer%|%album%|%<track>%
¦
%country%|'Performers & Producers'|'By their birthplace'|%artist%|%album%|%<track>%

Thanks in advance!