|
2 | 2 | "http://www.w3.org/TR/html4/loose.dtd"> |
3 | 3 | <html> |
4 | 4 | <head> |
| 5 | +<title>Copy & Edit of ID3 tags</title> |
5 | 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6 | | -<title>Copy of ID3 tags</title> |
| 7 | +<meta property="og:url" content="https://smolka.lima-city.de/"> |
| 8 | +<meta name="author" content="Jürgen Smolka"> |
| 9 | +<script type="text/javascript" src="dhtml.js"></script> |
7 | 10 | </head> |
8 | 11 |
|
9 | 12 | <?php |
|
12 | 15 | // (abc01.mp3 ==> dummy:X01-00.mp3 ==> abc00.mp3) |
13 | 16 | $quelle = ""; |
14 | 17 | $ziel = ""; |
| 18 | +$noquelle = ""; |
| 19 | +$noziel = ""; |
15 | 20 | $viewonly = ""; |
16 | 21 | $apicture = ""; |
17 | 22 | $Xpicture = ""; |
|
24 | 29 | $tags = ""; |
25 | 30 | $para = ""; |
26 | 31 | $paras = ""; |
| 32 | +$pflag = ""; |
27 | 33 | $array = null; |
28 | 34 | $shellBefehl = ""; |
29 | 35 |
|
|
37 | 43 | $Xpicture = "checked"; |
38 | 44 | if(isset($_POST["execute"])) |
39 | 45 | $execute = $_POST["execute"]; |
40 | | -if(isset($_POST["kopie"])) |
| 46 | +if(isset($_POST["kopie"]) && $quelle != $ziel) |
41 | 47 | $Xkopie = $_POST["kopie"]; |
42 | 48 | if(isset($_POST["befehl"])) |
43 | 49 | $befehl = $_POST["befehl"]; |
|
50 | 56 | $shellBefehl = "mid3v2 -l '$quelle'"; |
51 | 57 | exec($shellBefehl, $var); |
52 | 58 | $tags = $var; |
53 | | - // print_r($var); |
| 59 | + //print_r($var); |
| 60 | + //var_dump($var); |
| 61 | + if(!is_file($quelle) || !file_exists($quelle)) $noquelle = 'true'; |
54 | 62 | $shellBefehl = ""; |
55 | 63 | $var = ""; |
56 | 64 |
|
57 | 65 | $shellBefehl = "mid3v2 -l '$ziel'"; |
58 | 66 | exec($shellBefehl, $var); |
59 | 67 | // print_r($var); |
| 68 | + if(!is_file($ziel) || !file_exists($ziel)) $noziel = 'true'; |
60 | 69 | $shellBefehl = ""; |
61 | 70 | $var = ""; |
62 | 71 |
|
|
66 | 75 |
|
67 | 76 | foreach($tags as $tag) { |
68 | 77 | if(strstr($tag, "=")) { |
| 78 | + if(strstr($tag, "APIC=")) $pflag = "P"; |
69 | 79 | if(strstr($tag, "APIC=") || strstr($tag, "TLEN=") || strstr($tag, "unrepresentable data")) |
70 | 80 | continue; |
71 | 81 |
|
|
116 | 126 | $paras = trim($paras); |
117 | 127 | $paras = str_replace(" '' ", " ' ' ", $paras); // TPE1=' ' anstatt ='' |
118 | 128 |
|
119 | | - if($paras != "" || $paras != 0) |
120 | | - $shellBefehl = "mid3v2 $paras '$ziel'"; |
| 129 | + //if($paras != "" || $paras != 0) |
| 130 | + $shellBefehl = "mid3v2 $paras '$ziel'"; |
121 | 131 | $befehl = $shellBefehl; |
122 | 132 | } |
123 | 133 | //print ("\n<br>mid3cp '$quelle' '$ziel'"); |
|
131 | 141 | exec("mid3cp '$quelle' '$ziel'"); |
132 | 142 | } |
133 | 143 | exec($befehl, $var); |
134 | | - //print_r($var); |
135 | 144 | $shellBefehl = ""; |
136 | 145 | $var = ""; |
137 | 146 | } |
138 | 147 | } |
139 | 148 | ?> |
140 | 149 |
|
141 | 150 | <body> |
142 | | -<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>" style="margin-left:11%;"> |
| 151 | +<noscript style="text-align:center;"><h1>Please activate JavaScript</h1></noscript> |
| 152 | +<form name="id3" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>" style="margin-left:11%;"> |
143 | 153 | <fieldset style="width:900px;"> |
144 | 154 | <legend><span style="font-weight:700;">Files</span></legend> |
145 | 155 | <p> |
146 | | - source: <input type="text" name="quelle" style="width:777px;" value="<?php echo $quelle; ?>" required /> |
| 156 | + source: <input type="text" name="quelle" style="width:777px;" value="<?php echo $quelle; ?>" placeholder="./artist/album/title.mp3" required /> |
147 | 157 | </p> |
148 | 158 | <p> |
149 | | - target: <input type="text" name="ziel" style="width:777px;" value="<?php echo $ziel; ?>" required /> |
| 159 | + target: <input type="text" name="ziel" style="width:777px;" value="<?php echo $ziel; ?>" placeholder="./artist/album/title.mp3 (x01-00.mp3 may be used here)" required /> |
150 | 160 | </p> |
151 | | - <p> |
| 161 | + <p style="display:none"> |
152 | 162 | viewonly: <input type="checkbox" name="viewonly" checked /> |
153 | 163 | </p> |
154 | 164 | <p> |
155 | 165 | add Pic.: <input type="checkbox" name="apicture" <?php echo $Xpicture; ?> /> |
| 166 | + <?php if($pflag == "P") echo ' <img src="pic.jpg" width="22" height="22" alt="pic present!" title="dummy pic"> Picture present!'; ?> |
156 | 167 | </p> |
157 | 168 | <p> |
158 | 169 | copy first: <input type="checkbox" name="kopie" checked /> [edit after full copy (esp. w/ APIC, LINK ...)] |
159 | 170 | </p> |
160 | 171 | <p> |
161 | | - executeit: <input type="checkbox" name="execute" /> [edit textarea beforehand] |
| 172 | + executeit: <input type="checkbox" name="execute" /> [edit textarea beforehand] (list of <a href="./mid3TagMp3Frames.php" target="frame">tags/frames</a>) |
162 | 173 | </p> |
163 | 174 | </fieldset> |
164 | 175 |
|
|
169 | 180 | </p> |
170 | 181 | </form> |
171 | 182 | <?php |
| 183 | + if($noquelle || $noziel) { |
| 184 | + echo '<dir style="margin-left:8%; font-weight:bold;">'; |
| 185 | + if($noquelle) |
| 186 | + echo '<p style="color:red;">No source file found!</p>'; |
| 187 | + if($noziel) |
| 188 | + echo '<p style="color:red;">No target file found!</p>'; |
| 189 | + echo '</dir>'; |
| 190 | + exit(); |
| 191 | + } |
| 192 | + |
172 | 193 | if(isset($_POST["submit"])) { |
173 | | - echo('<dir style="margin-left:11%;">'); |
| 194 | + echo('<dir style="margin-left:8%;">'); |
174 | 195 | if($Xkopie) { echo("\n<br>'copy first' was $Xkopie <br>\n"); } |
175 | 196 | else { echo("\n<br>'copy first' was off <br>\n"); } |
176 | 197 | echo('</dir>'); |
| 198 | + echo("<br>\n"); |
| 199 | + echo('<script type="text/javascript">'); |
| 200 | + echo('if(document.id3.quelle.value == document.id3.ziel.value)'); |
| 201 | + echo(' clearCheck("name", "kopie", 0);'); |
| 202 | + echo('</script>'); |
| 203 | + echo("<br>\n"); |
177 | 204 | } |
178 | 205 | ?> |
179 | 206 | </body> |
|
0 commit comments