~ubuntu-branches/debian/sid/ampache/sid

« back to all changes in this revision

Viewing changes to bin/write_tags.inc

  • Committer: Package Import Robot
  • Author(s): Charlie Smotherman
  • Date: 2013-08-27 13:19:48 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20130827131948-1czew0zxn6u70dtv
Tags: 3.6-rzb2752+dfsg-1
* New upsteam snapshot.  Contains important bug fixes to the installer.
* Correct typo in ampache-common.postrm.
* Remove courtousy copy of php-getid3, during repack.  Closes: #701526
* Update package to use dh_linktree to make the needed sym links to the
  needed system libs that were removed during repack.
* Update debian/rules to reflect upstreams removing/moving of modules.
* Update debian/ampache-common.install to reflect upstreams removal of files.
* Updated to use new apache2.4 API. Closes: #669756
* Updated /debian/po/de.po thx David Prévot for the patch.  Closes:  #691963
* M3U import is now ordered, fixed upstream.  Closes: #684984
* Text input area has been resized so IPv6 addresses will now fit, fixed
  upstream.  Closes:  #716230
* Added ampache-common.preinst to make sure that the courtousy copies of code
  dirs are empty so dh_linktree can do it's magic on upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
 
2
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
3
3
/**
4
 
 * Write Tags
5
 
 *
6
4
 *
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
9
7
 *
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.
22
20
 *
23
 
 * @package     Ampache
24
 
 * @copyright   2001 - 2011 Ampache.org
25
 
 * @license     http://opensource.org/licenses/gpl-2.0 GPLv2
26
 
 * @link        http://www.ampache.org/
27
21
 */
28
22
 
29
23
/*
51
45
$flagged_ids = Flag::get_approved();
52
46
 
53
47
if (!count($flagged_ids)) {
54
 
        echo T_("No Flagged Songs Found, exiting...");
55
 
        echo "\n";
56
 
        exit;
 
48
    echo T_("No Flagged Songs Found, exiting...");
 
49
    echo "\n";
 
50
    exit;
57
51
}
58
52
 
59
53
// Loop through every song that has an approved flag
60
54
foreach($flagged_ids as $flagged) {
61
55
 
62
 
        $flag = new Flag($flagged);
63
 
        $song = new Song($flag->object_id);
64
 
 
65
 
        // Decide on what type of tag format to use, base on song type(a better way maybe?)
66
 
        switch($song->type) {
67
 
                case 'mp3':
68
 
                case 'mp2':
69
 
                case 'mp1':
70
 
                        $tagWriter = new getid3_write_apetag($song->file);
71
 
                        Flag::fill_tags( &$tagWriter, &$song, 'comment' );
72
 
                        break;
73
 
                case 'ogg':
74
 
                        $tagWriter = new getid3_write_vorbis($song->file);
75
 
                        Flag::fill_tags( &$tagWriter, &$song, 'comment' );
76
 
                        break;
77
 
                case 'flac':
78
 
                        $tagWriter = new getid3_write_flac($song->file);
79
 
                        Flag::fill_tags( &$tagWriter, &$song, 'comment' );
80
 
                        break;
81
 
                default:
82
 
                        echo T_('No Tag');
83
 
        } // end switch 
84
 
        
85
 
        if ( isset($tagWriter) ) {
86
 
 
87
 
                // Write out the tag
88
 
                try {
89
 
                        $tagWriter->write();
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());
92
 
                        echo "\n";
93
 
                        flush();
94
 
                        $flag->delete();
95
 
                }
96
 
                catch ( Exception $e ) {
97
 
                        print_r( $e->message() );
98
 
                }
99
 
        }
100
 
 
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);
 
58
 
 
59
    // Decide on what type of tag format to use, base on song type(a better way maybe?)
 
60
    switch($song->type) {
 
61
        case 'mp3':
 
62
        case 'mp2':
 
63
        case 'mp1':
 
64
            $tagWriter = new getid3_write_apetag($song->file);
 
65
            Flag::fill_tags( &$tagWriter, &$song, 'comment' );
 
66
            break;
 
67
        case 'ogg':
 
68
            $tagWriter = new getid3_write_vorbis($song->file);
 
69
            Flag::fill_tags( &$tagWriter, &$song, 'comment' );
 
70
            break;
 
71
        case 'flac':
 
72
            $tagWriter = new getid3_write_flac($song->file);
 
73
            Flag::fill_tags( &$tagWriter, &$song, 'comment' );
 
74
            break;
 
75
        default:
 
76
            echo T_('No Tag');
 
77
    } // end switch 
 
78
    
 
79
    if ( isset($tagWriter) ) {
 
80
 
 
81
        // Write out the tag
 
82
        try {
 
83
            $tagWriter->write();
 
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());
 
86
            echo "\n";
 
87
            flush();
 
88
            $flag->delete();
 
89
        }
 
90
        catch ( Exception $e ) {
 
91
            print_r( $e->message() );
 
92
        }
 
93
    }
 
94
 
 
95
    // Unset objects between iterations. getID3 seems to need this
 
96
    unset($tagWriter,$song,$flag);
103
97
 
104
98
}
105
99