How to set up autoupdating of the search database.

Frequently asked questions with answers

How to set up autoupdating of the search database.

Postby aba » Thu Jul 11, 2002 8:38 pm

From kPlaylist build 237 kPlaylist supports autoupdating of the search
database. This job can be done for example via lynx and cron. This
job is the same as you perform when you push the 'Update' button
in kPlaylist when you've logged in as a admin.

kPlaylist has by default disabled support for autoupdate via a variable
in the top of the script called $autoupdate. This is the default settings:

$autoupdate = 0;
$autoupdatehost = "127.0.0.1";
$autoupdateuser = "autooperate";


To enable autoupdating set $autoupdate = 1;

Now, you should try to run the update by opening a webbrowser and
entering the URL with the following parameters:

http://yoursite/playlist/index.php?upda ... utooperate

(Replace yoursite/playlist/index.php with the appropiate data
for your site.)

If the host you're trying to update from is equal to the one in
the $autoupdatehost variable, the update should start immediately once
you open the URL. If not, the autoupdate will let you know.

Once you're satisfied, you can make the autoupdate in a cron job, such
as this (all in one line):


0 * * * * /usr/bin/lynx -dump "http://yoursite/playlist/index.php?update=5000&user=autooperate"


This means, autoupdate once per hour and mail (if available) the summary to the default user.

You probably wonder what the 5000 parameter is? It's how many
microseconds (1.000.000 is one second.) kPlaylist will delay for each file it's read. 5000 is to sleep a 1/200 parts of second.

This is put in because the update tend to consume alot of resources. Set update=0 to disable for maximum speed and pain.
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby fenix » Thu Jul 11, 2002 10:13 pm

thanks!
trying it out now

Best regards
fenix
fenix
 
Posts: 21
Joined: Tue Jul 09, 2002 12:38 pm
Location: sweden

Re: How to set up autoupdating of the search database

Postby skeenan » Thu Jun 12, 2003 1:06 am

Shouldn't it be possible to run php from the command line to do this, rather than use lynx? :)
skeenan
 

Disk Sync

Postby starkiller » Sat Apr 29, 2006 11:12 pm

Is there a way to add and option for AutoUpdate to do a disksync as well, because it doesn't reflect any folder & file changes such as moves and deletes, or renames using the current setup?
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Re: Disk Sync

Postby aba » Sat Apr 29, 2006 11:30 pm

starkiller wrote:Is there a way to add and option for AutoUpdate to do a disksync as well, because it doesn't reflect any folder & file changes such as moves and deletes, or renames using the current setup?


If you read the first post in this topic, you will see that the auto update it explains will be a complete update that is equal to running a normal update as a admin.
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby starkiller » Sun Apr 30, 2006 1:24 am

Yes I know that, but it doesn't do what the disk sync function in the code does, my question is, is there a way to have it do that in the autoupdate, because I am usin auto-update and it doesn't reflect the above changes in file structure.

IE, I can rename a whole album of files and even after using AutoUpdate, or running update, it will still show both the old links(which are invalid) and the new ones pointing to the renamed files. If I go into settings and select the Automatic database sync option which calls the disk sync function, then it will reflect the changes, once I go to that folder.
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Postby aba » Sun Apr 30, 2006 2:01 am

starkiller wrote:Yes I know that, but it doesn't do what the disk sync function in the code does, my question is, is there a way to have it do that in the autoupdate, because I am usin auto-update and it doesn't reflect the above changes in file structure.

IE, I can rename a whole album of files and even after using AutoUpdate, or running update, it will still show both the old links(which are invalid) and the new ones pointing to the renamed files. If I go into settings and select the Automatic database sync option which calls the disk sync function, then it will reflect the changes, once I go to that folder.


The 'Automatic database sync' (Settings->File handling) is a minimized version of the update and takes only a directory at a time. Does your normal update work (update in the admin menu)? Which build of kPlaylist are you using? And are you sure that the auto-update actually are working?
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby starkiller » Sun Apr 30, 2006 2:26 am

I am using the Latest Dev build 424. The as far as If I am sure the updates are working, I know that it is working partially at least because If It sees the new file names, it just won't delete the old file names from the listing table, the ID3 Tags are the same, but the file name changes.

Other than this problem I love it, btw nice coding and commenting!

while I am working on this issue, I do have a feature request, can you enable and Admin to force a user to use the Lame codec and not be able to use the regular file streaming, ie so I can prevent my friends from changing to file streaming instead of the Lame 32K transcoding to conserve my bandwidth, oh and Lock them at that bitrate.
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Postby aba » Sun Apr 30, 2006 1:03 pm

starkiller wrote:I am using the Latest Dev build 424. The as far as If I am sure the updates are working, I know that it is working partially at least because If It sees the new file names, it just won't delete the old file names from the listing table, the ID3 Tags are the same, but the file name changes.

Other than this problem I love it, btw nice coding and commenting!

while I am working on this issue, I do have a feature request, can you enable and Admin to force a user to use the Lame codec and not be able to use the regular file streaming, ie so I can prevent my friends from changing to file streaming instead of the Lame 32K transcoding to conserve my bandwidth, oh and Lock them at that bitrate.


If you look inside the script, and search for the function called 'search_updateautomatic'. Uncommenting the following line:

Code: Select all
//$options['deleteunused'] = 1;


Will cause the automatic update to delete missing files after it's completed.

About the force of lame/bitrate, it's currently not possible. A few have asked about this, I will look into it.

Åge
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby starkiller » Sun Apr 30, 2006 3:54 pm

Code: Select all
function search_updateautomatic($user, $host, $waittrans=0)
{
   global $cfg, $setctl;
   $setctl->publish('followsymlinks');

   if ($cfg['autoupdate'])
   {
      if ($host == $cfg['autoupdatehost'] && $user == $cfg['autoupdateuser'])
      {
         $options['deleteunused'] = 1;
         $options['rebuildid3'] = 1;
         //$options['debugmode'] = 1;
         $options['sleeppertrans'] = $waittrans;
         search_updatelist($options);
      } else echo "Wrong host ($host) or user ($user) for update.";
   }
   die();
}


Thats what I have in it already, and it still has the issue.
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Postby aba » Fri May 05, 2006 8:25 am

starkiller wrote:[code]
Thats what I have in it already, and it still has the issue.


I have looked more into it, and I can't seem to find any bug. When
running 'autoupdate' via my browser it removes all links to non-existent files when //$options['deleteunused'] = 1; is uncommented. When you perform an update, does it complete? In other words, does it say in the end:

Inserted 0, updated 0, deleted 0 where .. etc ?

Åge
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby starkiller » Tue May 09, 2006 1:02 am

I am fixing to run 425 and I will update you on this, got busy with another project involving OpenBSD.
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Postby starkiller » Tue May 09, 2006 2:16 am

Code: Select all
Hold on - fetching file list..


Found 13488 files.


Done

.................

Inserted 35, updated 13216, deleted 0 where 0 failed and 1 skipped through 13487 files - 807.793 sec - 69590 marked for deletion.

Thats what I get when it completes.
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Postby aba » Tue May 09, 2006 7:08 am

starkiller wrote:
Code: Select all
Hold on - fetching file list..


Found 13488 files.


Done

.................

Inserted 35, updated 13216, deleted 0 where 0 failed and 1 skipped through 13487 files - 807.793 sec - 69590 marked for deletion.

Thats what I get when it completes.


One file is skipped, that's why it's acting like it is. Does it say which file is skipped?
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby starkiller » Wed May 10, 2006 12:22 am

ok, I am running that now, wanna know something even funnier,
everytime I run it, this count increease by the size of my mp3 collection

Playtime: 222d 13h 50m : 82841 files : 426112 mb
starkiller
 
Posts: 9
Joined: Sat Apr 29, 2006 11:10 pm

Next

Return to FAQ



cron