erland wrote: 
> The functionality is not available in the plugin and it's unlikely that
> I'll add something that modifies or delete music files.
> 
> If you are not using the music folder browse method and you are not
> doing this because you want to save storage space, I would personally
> recommend that you rather delete the tracks from the LMS database than
> deleting them physically from the disk. I think you should be able to do
> this by adding the necessary SQL statement in
> SQL/SQLite/schema_optimize.sql of your LMS installation. If I remember
> correctly the schema_optimize.sql script is executed at the end of every
> rescan.
> 
> It might be good enough to just delete them from the "tracks" table
> using a SQL like this in schema_optimize.sql:
> > 
Code:
--------------------
  >   > 
  > DELETE FROM tracks 
  > JOIN track_statistics ON 
  > tracks.url=track_statistics.url 
  > WHERE 
  > track_statistics.rating>0 AND 
  > track_statistics.rating<40;
  > 
--------------------
> > 
> 
> If this doesn't work, you might have to remove the entries from
> "genre_track","playlist_track" and "contributor_track" tables before
> you remove them from "tracks" table. You don't have to remove them
> from the "track_statistics" and "tracks_persistent" tables if you
> don't want to, the information in "track_statistics" and
> "track_persistent" will just be ignored if they don't exist in
> "tracks" table.
> 
> 
> Correct, the LMS database will be updated next time you do a full
> rescan, I don't think a scan for new/changed files will remove deleted
> files correctly.
> 
> 
> You will find the description of the TrackStat tables on the wiki:
> http://wiki.slimdevices.com/index.php/TrackStat_plugin#Database_structure
> 
> The SQL to use to get the files would probably be something like
> this:
> > 
Code:
--------------------
  >   > 
  > SELECT DISTINCT tracks.url FROM tracks 
  > JOIN track_statistics ON 
  > tracks.url=track_statistics.url 
  > WHERE 
  > track_statistics.rating>0 AND 
  > track_statistics.rating<40;
  > 
--------------------
> > 
> 
> Something that's going to complicate things is that this will return
> url and they will even be URL encoded urls.
> 
> So it will return something like
> > 
Code:
--------------------
  >   > 
file:///mnt/flacmusic/Christina%20Aguilera%20-%20Back%20To%20Basics%20Disc%202/I%20Got%20Trouble.flac
--------------------
> > 
> And to get the file, you need to first url decode it to get:
> > 
Code:
--------------------
  >   > file:///mnt/flacmusic/Christina Aguilera - Back To Basics Disc 2/I Got 
Trouble.flac
--------------------
> > 
> And then convert it from a URL to a file to get:
> > 
Code:
--------------------
  >   > /mnt/flacmusic/Christina Aguilera - Back To Basics Disc 2/I Got 
Trouble.flac
--------------------
> > 
> 
> If you are doing something in perl, there is a conversion function > 
Code:
--------------------
  >   > Slim::Utils::Misc::pathFromFileURL
--------------------
> >  in LMS source code which will convert the URL encoded url to a file,
> you will find it in the Misc.pm file:
> https://github.com/Logitech/slimserver/blob/public/7.8/Slim/Utils/Misc.pm

Thank you for the info the other week Erland. I had help from a Nix
friend and we solved the task with automatic deletion from low Trackstat
rated tracks. It is a 2 step proces. 

1. I use your plugin Database Query to shoot the query you gave me
above. I click the link to get info in the browser. It then displays all
tracks that are lower rated than 40%

2. I copy & paste this info into a specific location, where my
specificly named file is located, and paste info into this file.

3. I run a script that displays number of tracks in file - convert all
lines from URL to path on server - and finally delete all the tracks in
the txt file.

So I think this works in a good way. Thank you for background info to
enable us to do this.

Is there an easier way to shoot the SQL to the DB other than going via
your plugin in SBSs web-GUI? (something that can be scripted)?


------------------------------------------------------------------------
excalibur's Profile: http://forums.slimdevices.com/member.php?userid=33971
View this thread: http://forums.slimdevices.com/showthread.php?t=20533

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to