2
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
2
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
7
5
* LICENSE: GNU General Public License, version 2 (GPLv2)
8
* Copyright (c) 2001 - 2011 Ampache.org All Rights Reserved
6
* Copyright 2001 - 2013 Ampache.org
10
8
* This program is free software; you can redistribute it and/or
11
9
* modify it under the terms of the GNU General Public License v2
20
18
* along with this program; if not, write to the Free Software
21
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
* @copyright 2001 - 2011 Ampache.org
25
* @license http://opensource.org/licenses/gpl-2.0 GPLv2
26
* @link http://www.ampache.org/
51
45
$flagged_ids = Flag::get_approved();
53
47
if (!count($flagged_ids)) {
54
echo T_("No Flagged Songs Found, exiting...");
48
echo T_("No Flagged Songs Found, exiting...");
59
53
// Loop through every song that has an approved flag
60
54
foreach($flagged_ids as $flagged) {
62
$flag = new Flag($flagged);
63
$song = new Song($flag->object_id);
65
// Decide on what type of tag format to use, base on song type(a better way maybe?)
70
$tagWriter = new getid3_write_apetag($song->file);
71
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
74
$tagWriter = new getid3_write_vorbis($song->file);
75
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
78
$tagWriter = new getid3_write_flac($song->file);
79
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
85
if ( isset($tagWriter) ) {
90
// HINT: %1$s: title, %2$s: artist_name
91
printf (T_('Updated song %1$s by %2$s'), $song->title, $song->get_artist_name());
96
catch ( Exception $e ) {
97
print_r( $e->message() );
101
// Unset objects between iterations. getID3 seems to need this
102
unset($tagWriter,$song,$flag);
56
$flag = new Flag($flagged);
57
$song = new Song($flag->object_id);
59
// Decide on what type of tag format to use, base on song type(a better way maybe?)
64
$tagWriter = new getid3_write_apetag($song->file);
65
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
68
$tagWriter = new getid3_write_vorbis($song->file);
69
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
72
$tagWriter = new getid3_write_flac($song->file);
73
Flag::fill_tags( &$tagWriter, &$song, 'comment' );
79
if ( isset($tagWriter) ) {
84
// HINT: %1$s: title, %2$s: artist_name
85
printf (T_('Updated song %1$s by %2$s'), $song->title, $song->get_artist_name());
90
catch ( Exception $e ) {
91
print_r( $e->message() );
95
// Unset objects between iterations. getID3 seems to need this
96
unset($tagWriter,$song,$flag);