diff --git a/php/bin/add_artist_to_queue.php b/php/bin/add_artist_to_queue.php new file mode 100755 index 0000000..9959e14 --- /dev/null +++ b/php/bin/add_artist_to_queue.php @@ -0,0 +1,40 @@ +#!/opt/local/bin/php +getId($artist_name); + +if (!$artist_id) { + echo "Bad artist name!\n\n\n"; die; +} + +$albums = $rg_model->getArtistAlbums($artist_id); +$release_groups = $r_model->getReleases(array_keys($albums), true); + +$g_tracks = array(); +foreach ($release_groups as $release_group => $releases) { + $g_tracks[$release_group] = $t_model->getUniqueReleaseTracks(array_keys($releases)); +} + +foreach($g_tracks as $release_group => $tracks) { + $tracks = $tracks['tracks'] + $tracks['bonus']; + foreach ($tracks as $track) { + $track_id = $track['id']; + $track_title = addslashes($artist_name .' - '. $track['name']); + $track_length = $track['length']; + $q = "INSERT INTO beathaven.queue VALUES({$track_id}, 0, E'{$track_title}', {$track_length});"; + echo $q."\n"; + $db->q($q); + } +} \ No newline at end of file diff --git a/php/bin/parse_artist.php b/php/bin/parse_artist.php deleted file mode 100755 index 2733ee5..0000000 --- a/php/bin/parse_artist.php +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/php -getRows($db->q("SELECT * FROM beathaven.queue WHERE status=0 LIMIT 100")); + if (!$queue || count($queue) == 0) { + $continue = false; + } else { + foreach ($queue as $t) { + echo "#{$t['track_id']} {$t['track_title']}\n"; + echo "Loading file list: "; + $vk->parse($t['track_title']); + $files = $vk->getFiles(); + if ($files && count($files) > 0) { + echo "OK (".count($files).")\n"; + $tmp = explode(' - ', $t['track_title']); $artist_name = $tmp[0]; unset($tmp[0]); $track_name = implode(' - ', $tmp); + $files = VkontakteMP3::check($files, $artist_name, $track_name, $t['track_length']); + BeatDB::set($t['track_id'], $files); + echo "Good files: ". count($files) ."\n\n"; + $db->q("UPDATE beathaven.queue SET status=1 WHERE track_id=". $t['track_id']); + } else { + echo "FAILED\n\n"; + $db->q("UPDATE beathaven.queue SET status=2 WHERE track_id=". $t['track_id']); + } + } + } +} \ No newline at end of file diff --git a/php/classes/Vkontakte.class.php b/php/classes/Vkontakte.class.php index 15eac69..a435f16 100644 --- a/php/classes/Vkontakte.class.php +++ b/php/classes/Vkontakte.class.php @@ -5,7 +5,7 @@ $vk_parser = new Vkontakte(); $vk_parser->parse('Blondie - Call Me'); -$files = $weight_calc->getFiles(); +$files = $vk_parser->getFiles(); *****************************************************************/ /** diff --git a/php/classes/VkontakeMP3.class.php b/php/classes/VkontakteMP3.class.php similarity index 100% rename from php/classes/VkontakeMP3.class.php rename to php/classes/VkontakteMP3.class.php diff --git a/php/core/classes/Vkontakte.class.php b/php/core/classes/Vkontakte.class.php index ce77daf..fc23c35 100644 --- a/php/core/classes/Vkontakte.class.php +++ b/php/core/classes/Vkontakte.class.php @@ -5,7 +5,7 @@ $vk_parser = new Vkontakte(); $vk_parser->parse('Blondie - Call Me'); -$files = $weight_calc->getFiles(); +$files = $vk_parser->getFiles(); *****************************************************************/ /**