Page 1 of 1

Show/remove non-existent files

Posted: Sun Sep 18, 2011 1:18 pm
by Johnny
So currently, if a file ceases to exist in a playlist (say if you rename or delete it) when you try and play it, it gets skipped (I think the same thing happens in the media library).
However if you queue it, then playback altogether stops (maybe that should get fixed).

But anyway, it would be kinda cool if you could tell which files no longer exist, like if a little red cross appears next to them or something (even if you had to select something like "update all files").
On that same note, it would also be cool if there was an option to remove these non-existent files (kinda like there's an option to remove duplicates).

Mainly posting here 'cause Brett isn't on MSN and I don't want to forget.

Re: Show/remove non-existent files

Posted: Tue Sep 20, 2011 11:14 pm
by Harteex
Johnny wrote: But anyway, it would be kinda cool if you could tell which files no longer exist, like if a little red cross appears next to them or something (even if you had to select something like "update all files").
Maybe using gray color and italic for non-existant files :)

Re: Show/remove non-existent files

Posted: Sat Sep 24, 2011 1:37 am
by Brett
Maybe one of you more than capable programmers could actually do this :)

Re: Show/remove non-existent files

Posted: Sat Sep 24, 2011 6:58 am
by Johnny
Harteex wrote:Maybe using gray color and italic for non-existant files :)
That would also work.
Brett wrote:Maybe one of you more than capable programmers could actually do this :)
But then you wouldn't have the pleasure of implementing it yourself! :P
(plus I'm completely unfamiliar with tuniac's code base)

Re: Show/remove non-existent files

Posted: Sat Sep 24, 2011 10:03 am
by Brett
But I'll give you a head start.

A Library Entry already has a field in the current db for availability(unsigned long dwAvailablility), it will be currently set as 0 for all files and is currently not used anywhere in Tuniac.

LibraryEntry.h already defines:
#define AVAILABLILITY_AVAILABLE 0
#define AVAILABLILITY_UNAVAILABLE 1
#define AVAILABLILITY_UNKNOWN 2

IAudioSource.h needs a new define:
#define FIELD_AVAILABILITY 26



Currently in MediaLibraryPlaylistEntry.cpp things such as GetFieldNumber() and SetFieldNumber() have no access to the availability field and would need a quick update to support adjusting the field.

TuniacApp.cpp line 852 is of interest to catch the failed playback state.
NOTIFY_COREAUDIO_PLAYBACKFAILED message is sent from audio engine if the file is unplayable(likely invalid/corrupt or not available)

And at line 933
NOTIFY_COREAUDIO_PLAYBACKSTARTED could be used for if the file ever successfully plays again in the future.

Then you just need to set a style for things that have availability set as AVAILABLILITY_UNAVAILABLE.
I think you would do this in PlaylistSourceView.cpp around line 1405 in LVN_GETDISPINFO

Code: Select all

IPlaylist * pPlaylist = m_PlaylistManager.GetActivePlaylist();
if(pPlaylist)
{
  IPlaylistEntry * pEntry = pPlaylist->GetActiveEntry();
  if(pEntry)
  {
    pEntry->SetFieldNumber(FIELD_AVAILABILITY, AVAILABLILITY_UNAVAILABLE);
    //redraw window
    m_SourceSelectorWindow->UpdateView();
  }

}

Re: Show/remove non-existent files

Posted: Thu Sep 29, 2011 2:07 pm
by Brett
you guys are slacker than me :(


try 110929:
-add "x" image for unavailable files.
http://www.wasteofcash.com/Tuniac/

Re: Show/remove non-existent files

Posted: Thu Sep 29, 2011 7:09 pm
by jacoby
Does it handle unavailable files any different?

Now that unavailable files are marked, it should be pretty easy to add a 'remove missing files' option or something like that, right?

Re: Show/remove non-existent files

Posted: Thu Sep 29, 2011 8:48 pm
by Harteex
Brett wrote:Maybe one of you more than capable programmers could actually do this :)
I'd love to do some coding on Tuniac at some point, but now time is really a problem :(

Re: Show/remove non-existent files

Posted: Thu Sep 29, 2011 11:03 pm
by Brett
jacoby wrote:Does it handle unavailable files any different?

Now that unavailable files are marked, it should be pretty easy to add a 'remove missing files' option or something like that, right?
Sure, you could do add that :)
Easiest would be I make the "rebuild media library" under prefs remove files that are unavailable.

PS. 110929 code is not in svn yet, I wanted us to test this code a bit and see that it behaves right first :)