Ticket #1699: changes.3.patch
File changes.3.patch, 181.3 KB (added by , 18 years ago) |
---|
-
mythweb/skins/default/music.css
1 mp3act { 2 padding: 22px; 3 margin:0; 4 color: #333; 5 text-align: center; 6 font: 65% Verdana, Sans-serif; 7 } 8 9 h2.music{ 10 font-size: 100%; 11 margin:0; 12 padding: 0 0 5px 0; 13 14 } 15 ul.music{ 16 list-style-type: none; 17 } 18 a.music{ 19 color: blue; 20 } 21 22 a.music:hover{ 23 /*color: #fff; 24 background: #F21518; 25 text-decoration: none;*/ 26 color: #F21518; 27 } 28 img{ 29 border: 0; 30 } 31 input,select{ 32 border: 1px solid #ccc; 33 border-color: #aaa #ccc #ccc #aaa; 34 background: #f3f3f3; 35 color: #555; 36 font-size: 100%; 37 padding: 2px 3px; 38 vertical-align: middle; 39 40 } 41 input.check{ 42 border:0; 43 padding:0; 44 background: transparent; 45 } 46 select{ 47 padding: 2px 0 2px 3px; 48 } 49 input:focus{ 50 border: 1px solid #999; 51 background: #FBF9D3; 52 color: #000; 53 border-color: #777 #bbb #bbb #777; 54 } 55 56 input.btn,input.redbtn{ 57 background: #244A79; 58 color: #fff; 59 padding: 2px; 60 border-color: #0E2F58; 61 font: normal 10px sans-serif; 62 } 63 input.redbtn{ 64 background: #F21518; 65 } 66 input.redbtn:hover{ 67 background: #BE0D0F; 68 } 69 input.btn:hover{ 70 background: #0E2F58; 71 } 72 73 input.btn2{ 74 font-weight: bold; 75 padding: 2px; 76 } 77 78 input.btn2:hover{ 79 background: #eee; 80 border-color: #888; 81 color: #222; 82 } 83 84 .left{ 85 float: left; 86 } 87 .right{ 88 float: right; 89 } 90 .center{ 91 text-align: center; 92 } 93 .clear{ 94 clear: both; 95 } 96 .error{ 97 color: #E63838; 98 font-weight: bold; 99 } 100 p#error{ 101 color: #f20000; 102 font-weight: bold; 103 } 104 #breadcrumb{ 105 height: 14px; 106 padding:2px 0 0 0; 107 } 108 #breadcrumb span{ 109 position: relative; 110 } 111 #breadcrumb span:hover ul{ 112 display: block; 113 } 114 #breadcrumb ul{ 115 z-index: 5; 116 border: 1px solid #333; 117 display: none; 118 top:12px; 119 left:0; 120 position: absolute; 121 background: transparent url("./img/music/libg.png"); 122 color: #fff; 123 margin:-1px 0 0 0; 124 padding:0; 125 width: 150px; 126 127 } 128 #breadcrumb ul#letters{ 129 left: -55px; 130 width: auto; 131 } 132 #breadcrumb span{ 133 padding: 0; 134 margin:0; 135 } 136 #breadcrumb ul li{ 137 width: 100%; 138 padding:0; 139 margin:0; 140 z-index: 6; 141 } 142 #breadcrumb ul li a{ 143 display: block; 144 padding: 2px 4px; 145 color: #fff; 146 margin:0; 147 z-index: 5; 148 text-decoration: none; 149 font-weight: normal; 150 font-size: 90%; 151 } 152 153 #breadcrumb ul#letters li{ 154 float: left; 155 156 } 157 #breadcrumb ul#letters li a{ 158 float: left; 159 160 } 161 #breadcrumb ul li a:hover{ 162 background: #FCF7A5; 163 color: #000; 164 } 165 #breadcrumb ul#letters li a:hover{ 166 background: #FCF7A5; 167 color: #000; 168 } 169 #topinfo{ 170 171 font-size: 90%; 172 color: #666; 173 text-align: left; 174 padding: 0 0 4px 0; 175 176 } 177 p.pad{ 178 padding: 0px 8px; 179 } 180 181 #wrap{ 182 /*background: #fff; 183 border: 1px solid #ccc;*/ 184 text-align: left; 185 padding: 0px; 186 margin:0; 187 position: relative; 188 189 color: #333; 190 } 191 192 #header{ 193 position: relative; 194 /* background: #0E2F58;*/ 195 height: 50px; 196 color: #fff; 197 padding: 8px 0 0px 15px; 198 } 199 #header #controls{ 200 float: right; 201 background: transparent; 202 height: 48px; 203 margin-right: 8px; 204 width: 48%; 205 font-size: 90%; 206 line-height: 1.1em; 207 color: #fff; 208 } 209 210 #header #controls .buttons{ 211 float: left; 212 margin: 3px 5px 0 5px; 213 } 214 #header #controls .current{ 215 float: left; 216 margin-top: 3px; 217 218 } 219 #header h1{ 220 color: #9ABEE5; 221 padding: 0; 222 margin:0; 223 font-size: 150%; 224 } 225 ul#nav{ 226 position: absolute; 227 bottom:0; 228 list-style-type: none; 229 margin:0; 230 padding:0; 231 } 232 ul#nav li{ 233 float: left; 234 margin-right: 5px; 235 } 236 ul#nav li a{ 237 display: block; 238 background: #265990; //#244A79; 239 padding: 4px 5px; 240 color: #dedede; 241 text-decoration: none; 242 margin:0; 243 } 244 ul#nav li a:hover{ 245 background: #416899; 246 color: #fff; 247 } 248 ul#nav li a.c{ 249 background: #fff; 250 color: #F48603; 251 font-weight: bold; 252 } 253 #loading{ 254 display: none; 255 position: absolute; 256 top: 80px; 257 color: #78B855; 258 padding: 10px; 259 background: #CCFF99; 260 border: 1px solid #78B855; 261 z-index: 4; 262 left: 30%; 263 } 264 #loading h1{ 265 font-size: 140%; 266 } 267 #left{ 268 float: left; 269 width: 48%; 270 margin: 15px 0 25px 15px; 271 } 272 #right{ 273 float: right; 274 width: 45%; 275 margin: 15px 15px 25px 0; 276 277 } 278 .box{ 279 background: #E0E0E0; 280 border: 1px solid #ccc; 281 padding: 0 0 8px 0; 282 position: relative; 283 } 284 #box_extra{ 285 display: none; 286 z-index: 2; 287 position: absolute; 288 top: 25px; 289 left:5%; 290 width: 450px; 291 height: 190px; 292 background: transparent url("./img/music/libg.png"); 293 color: #fff; 294 font-size: 110%; 295 padding: 5px; 296 } 297 #box_extra h2{ 298 font-size: 120%; 299 } 300 #box_extra input{ 301 background: #333; 302 border-color: #999; 303 color: #fff; 304 } 305 306 #box_extra select{ 307 background: #333; 308 border-color: #999; 309 color: #fff; 310 } 311 312 .box ul{ 313 margin: 0 10px; 314 padding: 0px 0px; 315 background: #f3f3f3; 316 clear: both; 317 } 318 .box ul li{ 319 padding: 2px 0 1px 4px; 320 border: 1px solid transparent; 321 border-width: 1px 0px 1px 0px; 322 position: relative; 323 background: #f3f3f3; 324 } 325 326 .box ul li.alt{ 327 background: #DEE6EC; 328 } 329 .box ul li span.user{ 330 float: left; 331 width: 200px; 332 } 333 .box ul li small{ 334 color: #888; 335 letter-spacing: -1px; 336 } 337 338 .box ul li span.links a{ 339 text-decoration: underline; 340 color: blue; 341 } 342 .box ul li span.links a:hover{ 343 color: red; 344 } 345 .box ul li:hover{ 346 background: #FCF7A5; 347 color: #000; 348 border-color: #999; 349 } 350 .box ul li.currentplay{ 351 background: #96D1EF; 352 color: #000; 353 border-color: #666; 354 } 355 356 .box ul li p{ 357 z-index:5; 358 display: none; 359 position: absolute; 360 top: 7px; 361 font-size: 90%; 362 padding: 2px; 363 right: 15px; 364 width: 145px; 365 background: transparent url("./img/music/libg.png"); 366 color: #fff; 367 } 368 369 .box ul li:hover p{ 370 display: block; 371 } 372 373 .box ul li a{ 374 text-decoration: none; 375 color: #333; 376 } 377 .box ul li a:hover{ 378 color: #000; 379 } 380 .box ul#letters{ 381 height: 18px; 382 padding-left: 5px; 383 } 384 385 .box ul#letters li{ 386 float: left; 387 padding: 2px 2px; 388 background: none; 389 border: 1px solid transparent; 390 } 391 392 .box ul#letters li:hover{ 393 background: #FCF7A5; 394 border-color: #999; 395 } 396 397 .box p{ 398 padding: 0 10px; 399 margin: 8px 0 4px 0; 400 401 } 402 .box p img{ 403 display: block; 404 width: 60px; 405 float: right; 406 padding: 2px; 407 background: #f3f3f3; 408 border: 1px solid #999; 409 margin-bottom: 4px; 410 } 411 .box img#bigart{ 412 display: none; 413 position: absolute; 414 z-index: 2; 415 background: #f3f3f3; 416 padding: 3px; 417 border: 1px solid #666; 418 top:10px; 419 right: 80px; 420 } 421 .box p img:hover{ 422 border-color: #555; 423 cursor: pointer; 424 } 425 426 .box .head{ 427 padding: 4px; 428 background: #ccc; 429 } 430 .box .head a{ 431 background: #244A79; 432 color: #fff; 433 padding: 2px; 434 text-decoration: none; 435 font: normal 9px sans-serif; 436 } 437 .box .head a:hover{ 438 background: #0E2F58; 439 } 440 .box .head a.red{ 441 background: #F21518; 442 } 443 .box .head a.red:hover{ 444 background: #BE0D0F; 445 } 446 .box .head h2{ 447 font-size: 120%; 448 padding: 0; 449 } 450 .box h3{ 451 padding: 0 0 0 0px; 452 margin: 0 10px 0 10px; 453 font-size: 120%; 454 border-bottom: 1px solid #ccc; 455 } 456 457 .loginbox{ 458 width: 250px; 459 margin:0 auto; 460 background: #fff; 461 border: 1px solid #ccc; 462 text-align: left; 463 } 464 .loginbox p{ 465 padding: 8px 15px; 466 margin:0; 467 } 468 .noborder{ 469 background: transparent; 470 border:0; 471 } -
mythweb/skins/grey/music.css
Property changes on: mythweb/skins/default/music.css ___________________________________________________________________ Name: svn:executable + * Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/ff_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/libg.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/rew_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/paypal_donate.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/vol.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/rem.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/up.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/play.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/play_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/stop_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/down.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/add.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/default/img/music/progress_bar.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream
1 mp3act { 2 padding: 22px; 3 margin:0; 4 color: #333; 5 text-align: center; 6 font: 65% Verdana, Sans-serif; 7 } 8 9 h2.music{ 10 font-size: 100%; 11 margin:0; 12 padding: 0 0 5px 0; 13 14 } 15 ul.music{ 16 list-style-type: none; 17 } 18 a.music{ 19 color: blue; 20 } 21 22 a.music:hover{ 23 /*color: #fff; 24 background: #F21518; 25 text-decoration: none;*/ 26 color: #F21518; 27 } 28 img{ 29 border: 0; 30 } 31 input,select{ 32 border: 1px solid #ccc; 33 border-color: #aaa #ccc #ccc #aaa; 34 background: #f3f3f3; 35 color: #555; 36 font-size: 100%; 37 padding: 2px 3px; 38 vertical-align: middle; 39 40 } 41 input.check{ 42 border:0; 43 padding:0; 44 background: transparent; 45 } 46 select{ 47 padding: 2px 0 2px 3px; 48 } 49 input:focus{ 50 border: 1px solid #999; 51 background: #FBF9D3; 52 color: #000; 53 border-color: #777 #bbb #bbb #777; 54 } 55 56 input.btn,input.redbtn{ 57 background: #244A79; 58 color: #fff; 59 padding: 2px; 60 border-color: #0E2F58; 61 font: normal 10px sans-serif; 62 } 63 input.redbtn{ 64 background: #F21518; 65 } 66 input.redbtn:hover{ 67 background: #BE0D0F; 68 } 69 input.btn:hover{ 70 background: #0E2F58; 71 } 72 73 input.btn2{ 74 font-weight: bold; 75 padding: 2px; 76 } 77 78 input.btn2:hover{ 79 background: #eee; 80 border-color: #888; 81 color: #222; 82 } 83 84 .left{ 85 float: left; 86 } 87 .right{ 88 float: right; 89 } 90 .center{ 91 text-align: center; 92 } 93 .clear{ 94 clear: both; 95 } 96 .error{ 97 color: #E63838; 98 font-weight: bold; 99 } 100 p#error{ 101 color: #f20000; 102 font-weight: bold; 103 } 104 #breadcrumb{ 105 height: 14px; 106 padding:2px 0 0 0; 107 } 108 #breadcrumb span{ 109 position: relative; 110 } 111 #breadcrumb span:hover ul{ 112 display: block; 113 } 114 #breadcrumb ul{ 115 z-index: 5; 116 border: 1px solid #333; 117 display: none; 118 top:12px; 119 left:0; 120 position: absolute; 121 background: transparent url("./img/music/libg.png"); 122 color: #fff; 123 margin:-1px 0 0 0; 124 padding:0; 125 width: 150px; 126 127 } 128 #breadcrumb ul#letters{ 129 left: -55px; 130 width: auto; 131 } 132 #breadcrumb span{ 133 padding: 0; 134 margin:0; 135 } 136 #breadcrumb ul li{ 137 width: 100%; 138 padding:0; 139 margin:0; 140 z-index: 6; 141 } 142 #breadcrumb ul li a{ 143 display: block; 144 padding: 2px 4px; 145 color: #fff; 146 margin:0; 147 z-index: 5; 148 text-decoration: none; 149 font-weight: normal; 150 font-size: 90%; 151 } 152 153 #breadcrumb ul#letters li{ 154 float: left; 155 156 } 157 #breadcrumb ul#letters li a{ 158 float: left; 159 160 } 161 #breadcrumb ul li a:hover{ 162 background: #FCF7A5; 163 color: #000; 164 } 165 #breadcrumb ul#letters li a:hover{ 166 background: #FCF7A5; 167 color: #000; 168 } 169 #topinfo{ 170 171 font-size: 90%; 172 color: #666; 173 text-align: left; 174 padding: 0 0 4px 0; 175 176 } 177 p.pad{ 178 padding: 0px 8px; 179 } 180 181 #wrap{ 182 /*background: #fff; 183 border: 1px solid #ccc;*/ 184 text-align: left; 185 padding: 0px; 186 margin:0; 187 position: relative; 188 189 color: #333; 190 } 191 192 #header{ 193 position: relative; 194 /* background: #0E2F58;*/ 195 height: 50px; 196 color: #fff; 197 padding: 8px 0 0px 15px; 198 } 199 #header #controls{ 200 float: right; 201 background: transparent; 202 height: 48px; 203 margin-right: 8px; 204 width: 48%; 205 font-size: 90%; 206 line-height: 1.1em; 207 color: #fff; 208 } 209 210 #header #controls .buttons{ 211 float: left; 212 margin: 3px 5px 0 5px; 213 } 214 #header #controls .current{ 215 float: left; 216 margin-top: 3px; 217 218 } 219 #header h1{ 220 color: #9ABEE5; 221 padding: 0; 222 margin:0; 223 font-size: 150%; 224 } 225 ul#nav{ 226 position: absolute; 227 bottom:0; 228 list-style-type: none; 229 margin:0; 230 padding:0; 231 } 232 ul#nav li{ 233 float: left; 234 margin-right: 5px; 235 } 236 ul#nav li a{ 237 display: block; 238 background: #666666; //#244A79; 239 padding: 4px 5px; 240 color: #ffffff; 241 text-decoration: none; 242 margin:0; 243 } 244 ul#nav li a:hover{ 245 background: #416899; 246 color: #fff; 247 } 248 ul#nav li a.c{ 249 background: #fff; 250 color: #F48603; 251 font-weight: bold; 252 } 253 #loading{ 254 display: none; 255 position: absolute; 256 top: 80px; 257 color: #78B855; 258 padding: 10px; 259 background: #CCFF99; 260 border: 1px solid #78B855; 261 z-index: 4; 262 left: 30%; 263 } 264 #loading h1{ 265 font-size: 140%; 266 } 267 #left{ 268 float: left; 269 width: 48%; 270 margin: 15px 0 25px 15px; 271 } 272 #right{ 273 float: right; 274 width: 45%; 275 margin: 15px 15px 25px 0; 276 277 } 278 .box{ 279 background: #E0E0E0; 280 border: 1px solid #ccc; 281 padding: 0 0 8px 0; 282 position: relative; 283 } 284 #box_extra{ 285 display: none; 286 z-index: 2; 287 position: absolute; 288 top: 25px; 289 left:5%; 290 width: 450px; 291 height: 190px; 292 background: transparent url("./img/music/libg.png"); 293 color: #fff; 294 font-size: 110%; 295 padding: 5px; 296 } 297 #box_extra h2{ 298 font-size: 120%; 299 } 300 #box_extra input{ 301 background: #333; 302 border-color: #999; 303 color: #fff; 304 } 305 306 #box_extra select{ 307 background: #333; 308 border-color: #999; 309 color: #fff; 310 } 311 312 .box ul{ 313 margin: 0 10px; 314 padding: 0px 0px; 315 background: #f3f3f3; 316 clear: both; 317 } 318 .box ul li{ 319 padding: 2px 0 1px 4px; 320 border: 1px solid transparent; 321 border-width: 1px 0px 1px 0px; 322 position: relative; 323 background: #f3f3f3; 324 } 325 326 .box ul li.alt{ 327 background: #DEE6EC; 328 } 329 .box ul li span.user{ 330 float: left; 331 width: 200px; 332 } 333 .box ul li small{ 334 color: #888; 335 letter-spacing: -1px; 336 } 337 338 .box ul li span.links a{ 339 text-decoration: underline; 340 color: blue; 341 } 342 .box ul li span.links a:hover{ 343 color: red; 344 } 345 .box ul li:hover{ 346 background: #FCF7A5; 347 color: #000; 348 border-color: #999; 349 } 350 .box ul li.currentplay{ 351 background: #96D1EF; 352 color: #000; 353 border-color: #666; 354 } 355 356 .box ul li p{ 357 z-index:5; 358 display: none; 359 position: absolute; 360 top: 7px; 361 font-size: 90%; 362 padding: 2px; 363 right: 15px; 364 width: 145px; 365 background: transparent url("./img/music/libg.png"); 366 color: #fff; 367 } 368 369 .box ul li:hover p{ 370 display: block; 371 } 372 373 .box ul li a{ 374 text-decoration: none; 375 color: #333; 376 } 377 .box ul li a:hover{ 378 color: #000; 379 } 380 .box ul#letters{ 381 height: 18px; 382 padding-left: 5px; 383 } 384 385 .box ul#letters li{ 386 float: left; 387 padding: 2px 2px; 388 background: none; 389 border: 1px solid transparent; 390 } 391 392 .box ul#letters li:hover{ 393 background: #FCF7A5; 394 border-color: #999; 395 } 396 397 .box p{ 398 padding: 0 10px; 399 margin: 8px 0 4px 0; 400 401 } 402 .box p img{ 403 display: block; 404 width: 60px; 405 float: right; 406 padding: 2px; 407 background: #f3f3f3; 408 border: 1px solid #999; 409 margin-bottom: 4px; 410 } 411 .box img#bigart{ 412 display: none; 413 position: absolute; 414 z-index: 2; 415 background: #f3f3f3; 416 padding: 3px; 417 border: 1px solid #666; 418 top:10px; 419 right: 80px; 420 } 421 .box p img:hover{ 422 border-color: #555; 423 cursor: pointer; 424 } 425 426 .box .head{ 427 padding: 4px; 428 background: #ccc; 429 } 430 .box .head a{ 431 background: #244A79; 432 color: #fff; 433 padding: 2px; 434 text-decoration: none; 435 font: normal 9px sans-serif; 436 } 437 .box .head a:hover{ 438 background: #0E2F58; 439 } 440 .box .head a.red{ 441 background: #F21518; 442 } 443 .box .head a.red:hover{ 444 background: #BE0D0F; 445 } 446 .box .head h2{ 447 font-size: 120%; 448 padding: 0; 449 } 450 .box h3{ 451 padding: 0 0 0 0px; 452 margin: 0 10px 0 10px; 453 font-size: 120%; 454 border-bottom: 1px solid #ccc; 455 } 456 457 .loginbox{ 458 width: 250px; 459 margin:0 auto; 460 background: #fff; 461 border: 1px solid #ccc; 462 text-align: left; 463 } 464 .loginbox p{ 465 padding: 8px 15px; 466 margin:0; 467 } 468 .noborder{ 469 background: transparent; 470 border:0; 471 } -
mythweb/modules/music/mp3act_main.php
Property changes on: mythweb/skins/grey/music.css ___________________________________________________________________ Name: svn:executable + * Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/ff_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/libg.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/rew_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/paypal_donate.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/vol.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/rem.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/up.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/play.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/play_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/stop_big.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/down.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/add.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: mythweb/skins/grey/img/music/progress_bar.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream
1 <?php 2 /************************************************************************* 3 * mp3act Digital Music System - A streaming and jukebox solution for your digital music collection 4 * http://www.mp3act.net 5 * Copyright (C) 2005 Jon Buda (www.jonbuda.com) 6 * 7 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 10 * 11 * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12 *************************************************************************/ 13 14 include_once("modules/music/mp3act_functions.php"); 15 require_once("modules/music/mp3act_sajax.php"); 16 17 $sajax_remote_uri = 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['SCRIPT_NAME'],0,strlen($_SERVER['SCRIPT_NAME']) - 11).'music/'; 18 $sajax_request_type = "POST"; 19 sajax_init(); 20 // list of functions to export 21 sajax_export("getCurrentSong","getUser","musicLookup","playlist_rem","playlist_add","playlistInfo","clearPlaylist","buildBreadcrumb","play","playlist_move","searchMusic","editUser","switchMode","viewPlaylist","getDropDown","savePlaylist","getRandItems","randPlay","resetDatabase","createInviteCode","editSettings","deletePlaylist","adminEditUsers","adminAddUser","submitScrobbler"); 22 sajax_handle_client_request(); // serve client instances 23 24 require 'modules/_shared/tmpl/'.tmpl.'/header.php'; 25 ?> 26 <link rel="Stylesheet" href="<?php echo skin_url ?>music.css" type="text/css" /> 27 28 <script type="text/javascript"> 29 var page = 'search'; 30 var mode = '<?php echo $_SESSION['sess_playmode']; ?>'; 31 var bc_parenttype = ''; 32 var bc_parentitem = ''; 33 var bc_childtype = ''; 34 var bc_childitem = ''; 35 var prevpage = ''; 36 var currentpage = 'search'; 37 var nowplaying = 0; 38 var isplaying = 0; 39 var clearbc = 1; 40 41 <?php sajax_show_javascript(); ?></script> 42 <script type="text/javascript" src="<?php echo root; ?>music/mp3act_js.js.php"></script> 43 <script type="text/javascript" src="<?php echo root; ?>music/mp3act_fat.js"></script> 44 45 <div id="wrap"> 46 <div id="header"> 47 <div id="controls"> 48 49 </div> 50 <h1 id="pagetitle"></h1> 51 <ul class="music" id="nav"> 52 <li><a href="#" id="search_music" onclick="switchPage('search'); return false;" title="Search the Music Database">Search</a></li> 53 <li><a href="#" id="browse" onclick="switchPage('browse'); return false;" title="Browse the Music Database" class="c">Browse</a></li> 54 <li><a href="#" id="random" onclick="switchPage('random'); return false;" title="Create Random Mixes">Random</a></li> 55 <li><a href="#" id="playlists" onclick="switchPage('playlists'); return false;" title="Load Saved Playlists">Playlists</a></li> 56 <li><a href="#" id="stats" onclick="switchPage('stats'); return false;" title="View Server Statistics">Stats</a></li> 57 </ul> 58 59 </div> 60 <div id="loading"><h1>LOADING...</h1></div> 61 <div id="left"> 62 <div class="box" id="info"> 63 <h2 id="breadcrumb"></h2> 64 </div> 65 </div> 66 67 <div id="right"> 68 <div class="box"> 69 <div class="head"> 70 <div class="right"><a href="#" onclick="play('pl',0); return false;" title="Play This Playlist Now">play</a> <a href="#" onclick="savePL('open',0); return false;" title="Save Current Playlist">save</a> <a href="#" onclick="plclear(); return false;"class="red" title="Clear the Current Playlist">clear</a></div> 71 <h2 id="pl_title"></h2><span id="pl_info"></span> 72 </div> 73 <ul class="music" id="playlist"> 74 75 </ul> 76 77 <div id="box_extra"> </div> 78 </div> 79 </div> 80 <div class="clear"></div> 81 </div> 82 <iframe src="<?php echo root; ?>music/mp3act_hidden.php" frameborder="0" height="0" width="0" id="hidden" name="hidden"></iframe> 83 <? 84 require 'modules/_shared/tmpl/'.tmpl.'/footer.php'; 85 ?> -
mythweb/modules/music/handler.php
Property changes on: mythweb/modules/music/mp3act_main.php ___________________________________________________________________ Name: svn:executable + *
13 13 * 14 14 /**/ 15 15 16 // Make sure the music directory exists 17 if (file_exists('data/music')) { 18 // File is not a directory or a symlink 19 if (!is_dir('data/music') && !is_link('data/music')) { 20 custom_error('An invalid file exists at data/music. Please remove it in' 21 .' order to use the music portions of MythWeb.'); 22 } 23 } 24 // Create the symlink, if possible. 25 // 26 // NOTE: Errors have been disabled because if I turn them on, people hosting 27 // MythWeb on Windows machines will have issues. I will turn the errors 28 // back on when I find a clean way to do so. 29 // 30 else { 31 $dir = $db->query_col('SELECT data 32 FROM settings 33 WHERE value="MusicLocation" AND hostname=?', 34 hostname 35 ); 36 if ($dir) { 37 $ret = @symlink($dir, 'data/music'); 38 if (!$ret) { 39 #custom_error("Could not create a symlink to $dir, the local MythMusic directory" 40 # .' for this hostname ('.hostname.'). Please create a symlink to your' 41 # .' MythMusic directory at data/music in order to use the music' 42 # .' portions of MythWeb.'); 43 } 44 } 45 else { 46 #custom_error('Could not find a value in the database for the MythMusic directory' 47 # .' for this hostname ('.hostname.'). Please create a symlink to your' 48 # .' MythMusic directory at data/music in order to use the music' 49 # .' portions of MythWeb.'); 50 } 51 } 16 if (tmpl == "compact") 17 { 18 require_once("modules/music/music_handler.php"); 19 } 20 else 21 { 22 // require_once "includes/init.php"; 52 23 53 // 54 // Someday, music.php will let us stream 55 // entire playlists to any spot on planet earth 56 // 57 require_once tmpl_dir.'music.php'; 58 59 $mythmusic = new mythMusic(); 60 $mythmusic->display(); 61 62 class mythMusic { 63 var $filterPlaylist; 64 var $filterArtist; 65 var $filterAlbum; 66 var $filterGenre; 67 var $filterRank; 68 var $filterSonglist; 69 var $keepFilters; 70 var $filter; 71 var $totalCount; 72 var $offset; 73 74 var $result; 75 76 77 var $intid; 78 var $artist; 79 var $album; 80 var $title; 81 var $genre; 82 var $length; 83 var $rating; 84 var $filename; 85 var $urlfilename; 86 87 var $alphalink; 88 var $alphaoffset; 89 90 function mythMusic() 91 { 92 if($_GET['offset'] >=0 ) 93 $this->offset=$_GET['offset']; 94 else 95 $this->offset=0; 96 97 /**** If alphalink set, then change offset to new value ****/ 98 if ($_GET['alphalink']) { 99 $alphalink = $_GET['alphalink']; 100 $result=mysql_query("select count(1) from musicmetadata where upper(artist) < ".escape($alphalink)); 101 $alphaoffset=mysql_fetch_row($result); 102 $this->offset=$alphaoffset[0]; 103 mysql_free_result($result); 104 } 105 106 if($_GET['filterPlaylist']) 107 { 108 $this->filterPlaylist=$_GET['filterPlaylist']; 109 $_GET['filterPlaylist']; 110 } 111 else 112 $this->filterPlaylist="_All_"; 113 114 if($_GET['filterArtist']) 115 { 116 $this->filterArtist=$_GET['filterArtist']; 117 } 118 else 119 $this->filterArtist="_All_"; 120 121 if($_GET['filterAlbum']) 122 { 123 $this->filterAlbum=$_GET['filterAlbum']; 124 } 125 else 126 $this->filterAlbum="_All_"; 127 if($_GET['filterGenre']) 128 { 129 $this->filterGenre=$_GET['filterGenre']; 130 } 131 else 132 $this->filterGenre="_All_"; 133 134 135 if($_GET['filterRank']) 136 $this->filterRank=$_GET['filterRank']; 137 else 138 $this->filterRank="_All_"; 139 } 140 141 function readRow() 142 { 143 144 if($row=mysql_fetch_row($this->result)) 145 { 146 $this->intid=$row[0]; 147 $this->artist=$row[1]; 148 $this->album=$row[2]; 149 $this->title=$row[3]; 150 $this->genre=$row[4]; 151 $this->length=$row[5]; 152 $this->rating=$row[6]; 153 $this->filename=$row[7]; 154 155 $this->urlfilename=root.'data/music'; 156 global $musicdir; 157 foreach (preg_split('/\//', substr($this->filename, strlen($musicdir))) as $dir) { 158 if (!$dir) continue; 159 $this->urlfilename .= '/'.rawurlencode(utf8tolocal($dir)); 160 } 161 162 return(true); 163 } 164 return(false); 165 } 166 167 168 169 function display() 170 { 171 $music = new Theme_music(); 172 $this->init($music->getMaxPerPage()); 173 $music->setOffset($this->offset); 174 $music->setTotalCount($this->totalCount); 175 176 $music->print_header($this->filterPlaylist,$this->filterArtist,$this->filterAlbum,$this->filterGenre); 177 if($this->totalCount > 0) 178 { 179 while($this->readRow()) 180 { 181 $music->printDetail($this->title,$this->length,$this->artist,$this->album,$this->genre,$this->urlfilename); 182 } 183 } 184 else 185 { 186 $music->printNoDetail(); 187 } 188 if($this->result) 189 mysql_free_result($this->result); 190 191 $music->print_footer(); 192 } 193 194 function prepFilter() 195 { 196 $prevFilter=0; 197 $thisFilter=""; 198 199 if($this->filterPlaylist != "_All_") 200 { 201 $playlistResult = mysql_query("select playlistid,name,songlist,hostname from musicplaylist where playlistid=".escape($this->filterPlaylist)); 202 if($playlistResult) 203 { 204 if(mysql_num_rows($playlistResult)==1) 205 { 206 $row=mysql_fetch_row($playlistResult); 207 if($row) 208 { 209 210 $this->filterSonglist=$row[2]; 211 if($prevFilter==1) 212 $this->filter=$this->filter . "and intid in (" . $this->filterSonglist . ")"; 213 else 214 { 215 $this->filter="intid in (" . $this->filterSonglist . ")"; 216 $prevFilter=1; 217 } 218 219 $this->keepFilters="&filterPlaylist=" . urlencode($this->filterPlaylist); 220 221 } 222 } 223 } 224 } 225 226 if($this->filterArtist != "_All_" ) 227 { 228 if($prevFilter==1) 229 $this->filter=$this->filter . "and artist=".escape($this->filterArtist); 230 else 231 { 232 $this->filter="artist=".escape($this->filterArtist); 233 $prevFilter=1; 234 } 235 236 $this->keepFilters="&filterArtist=" . urlencode($this->filterArtist); 237 238 } 239 if($this->filterAlbum != "_All_") 240 { 241 if($prevFilter==1) 242 { 243 $this->filter= $this->filter . "and album=\"" . $this->filterAlbum . "\""; 244 } 245 else 246 { 247 $this->filter="album=\"" . $this->filterAlbum . "\""; 248 $prevFilter=1; 249 } 250 $this->keepFilters =$this->keepFilters . "&filterAlbum=" . urlencode($this->filterAlbum) ; 251 252 } 253 if($this->filterGenre != "_All_") 254 { 255 if($prevFilter==1) 256 { 257 $this->filter= $this->filter . "and genre=" . $this->filterGenre ; 258 } 259 else 260 { 261 $this->filter="genre=\"" . $this->filterGenre . "\""; 262 $prevFilter=1; 263 } 264 $this->keepFilters =$this->keepFilters . "&filterGenre=" . urlencode($this->filterGenre); 265 266 } 267 268 if($this->filterRank != "_All_") 269 { 270 if($prevFilter==1) 271 { 272 $this->filter=$this->filter . "and rank=" . $this->filterRank; 273 } 274 else 275 { 276 $this->filter="rank=" . $this->filterRank; 277 $prevFilter=1; 278 } 279 $this->keepFilters =$this->keepFilters . "&filterRank=" . urlencode($this->filterRank); 280 } 281 282 283 284 } 285 286 function init($maxPerPage) { 287 global $db; 288 $this->prepFilter(); 289 if (empty($this->filter)) 290 $this->totalCount = $db->query_col('SELECT COUNT(*) FROM musicmetadata'); 291 else 292 $this->totalCount = $db->query_col('SELECT COUNT(*) FROM musicmetadata WHERE '.$this->filter); 293 294 if ($this->totalCount > 0) { 295 if($this->offset > 0) { 296 $limitText='LIMIT ' . $this->offset . ',' . $maxPerPage; 297 } 298 else 299 $limitText='LIMIT ' . $maxPerPage; 300 301 if (empty($this->filter)) 302 $this->result=mysql_query("select intid,artist,album,title,genre,length,rating,filename from musicmetadata order by artist,album,tracknum " . $limitText); 303 else 304 $this->result=mysql_query("select intid,artist,album,title,genre,length,rating,filename from musicmetadata where $this->filter order by artist,album,tracknum $limitText"); 305 } 306 } 307 } 308 309 24 if (in_array($Path[1], array('mp3act_js.js.php', 'mp3act_fat.js', 'mp3act_hidden.php'))) 25 { 26 require_once 'modules/music/'.$Path[1]; 27 exit(); 28 } 29 if (strstr($Path[1],"mp3act_playstream.php") != false) 30 { 31 require_once 'modules/music/mp3act_playstream.php'; 32 exit(); 33 } 34 35 require_once 'modules/music/mp3act_main.php'; 36 } 37 ?> 38 No newline at end of file -
mythweb/modules/music/music_handler.php
1 <?php 2 /** 3 * MythMusic browser 4 * 5 * @url $URL: svn+ssh://xris@cvs.mythtv.org/var/lib/svn/trunk/mythplugins/mythweb/modules/music/init.php $ 6 * @date $Date: 2006-03-26 12:09:14 +0200 (So, 26 MÀr 2006) $ 7 * @version $Revision: 9493 $ 8 * @author $Author: xris $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * @subpackage Music 13 * 14 /**/ 15 16 // Make sure the music directory exists 17 if (file_exists('data/music')) { 18 // File is not a directory or a symlink 19 if (!is_dir('data/music') && !is_link('data/music')) { 20 custom_error('An invalid file exists at data/music. Please remove it in' 21 .' order to use the music portions of MythWeb.'); 22 } 23 } 24 // Create the symlink, if possible. 25 // 26 // NOTE: Errors have been disabled because if I turn them on, people hosting 27 // MythWeb on Windows machines will have issues. I will turn the errors 28 // back on when I find a clean way to do so. 29 // 30 else { 31 $dir = $db->query_col('SELECT data 32 FROM settings 33 WHERE value="MusicLocation" AND hostname=?', 34 hostname 35 ); 36 if ($dir) { 37 $ret = @symlink($dir, 'data/music'); 38 if (!$ret) { 39 #custom_error("Could not create a symlink to $dir, the local MythMusic directory" 40 # .' for this hostname ('.hostname.'). Please create a symlink to your' 41 # .' MythMusic directory at data/music in order to use the music' 42 # .' portions of MythWeb.'); 43 } 44 } 45 else { 46 #custom_error('Could not find a value in the database for the MythMusic directory' 47 # .' for this hostname ('.hostname.'). Please create a symlink to your' 48 # .' MythMusic directory at data/music in order to use the music' 49 # .' portions of MythWeb.'); 50 } 51 } 52 53 // 54 // Someday, music.php will let us stream 55 // entire playlists to any spot on planet earth 56 // 57 require_once tmpl_dir.'music.php'; 58 59 $mythmusic = new mythMusic(); 60 $mythmusic->display(); 61 62 class mythMusic { 63 var $filterPlaylist; 64 var $filterArtist; 65 var $filterAlbum; 66 var $filterGenre; 67 var $filterRank; 68 var $filterSonglist; 69 var $keepFilters; 70 var $filter; 71 var $totalCount; 72 var $offset; 73 74 var $result; 75 76 77 var $intid; 78 var $artist; 79 var $album; 80 var $title; 81 var $genre; 82 var $length; 83 var $rating; 84 var $filename; 85 var $urlfilename; 86 87 var $alphalink; 88 var $alphaoffset; 89 90 function mythMusic() 91 { 92 if($_GET['offset'] >=0 ) 93 $this->offset=$_GET['offset']; 94 else 95 $this->offset=0; 96 97 /**** If alphalink set, then change offset to new value ****/ 98 if ($_GET['alphalink']) { 99 $alphalink = $_GET['alphalink']; 100 101 $result=mysql_query("SELECT count(1) FROM music_songs INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id WHERE (((UPPER(music_artists.artist_name))< \"".$alphalink."\")) ORDER BY music_artists.artist_name;"); 102 $alphaoffset=mysql_fetch_row($result); 103 $this->offset=$alphaoffset[0]; 104 mysql_free_result($result); 105 } 106 107 if($_GET['filterPlaylist']) 108 { 109 $this->filterPlaylist=$_GET['filterPlaylist']; 110 $_GET['filterPlaylist']; 111 } 112 else 113 $this->filterPlaylist="_All_"; 114 115 if($_GET['filterArtist']) 116 { 117 $this->filterArtist=$_GET['filterArtist']; 118 } 119 else 120 $this->filterArtist="_All_"; 121 122 if($_GET['filterAlbum']) 123 { 124 $this->filterAlbum=$_GET['filterAlbum']; 125 } 126 else 127 $this->filterAlbum="_All_"; 128 if($_GET['filterGenre']) 129 { 130 $this->filterGenre=$_GET['filterGenre']; 131 } 132 else 133 $this->filterGenre="_All_"; 134 135 136 if($_GET['filterRank']) 137 $this->filterRank=$_GET['filterRank']; 138 else 139 $this->filterRank="_All_"; 140 } 141 142 function readRow() 143 { 144 145 if($row=mysql_fetch_row($this->result)) 146 { 147 $this->intid=$row[0]; 148 $this->artist=$row[1]; 149 $this->album=$row[2]; 150 $this->title=$row[3]; 151 $this->genre=$row[4]; 152 $this->length=$row[5]; 153 $this->rating=$row[6]; 154 $this->filename=$row[7]; 155 156 $this->urlfilename=root.'data/music'; 157 global $musicdir; 158 foreach (preg_split('/\//', substr($this->filename, strlen($musicdir))) as $dir) { 159 if (!$dir) continue; 160 $this->urlfilename .= '/'.rawurlencode(utf8tolocal($dir)); 161 } 162 163 return(true); 164 } 165 return(false); 166 } 167 168 169 170 function display() 171 { 172 $music = new Theme_music(); 173 $this->init($music->getMaxPerPage()); 174 $music->setOffset($this->offset); 175 $music->setTotalCount($this->totalCount); 176 177 $music->print_header($this->filterPlaylist,$this->filterArtist,$this->filterAlbum,$this->filterGenre); 178 if($this->totalCount > 0) 179 { 180 while($this->readRow()) 181 { 182 $music->printDetail($this->title,$this->length,$this->artist,$this->album,$this->genre,$this->urlfilename); 183 } 184 } 185 else 186 { 187 $music->printNoDetail(); 188 } 189 if($this->result) 190 mysql_free_result($this->result); 191 192 $music->print_footer(); 193 } 194 195 function prepFilter() 196 { 197 $prevFilter=0; 198 $thisFilter=""; 199 200 if($this->filterPlaylist != "_All_") 201 { 202 $playlistResult = mysql_query("select playlistid,name,songlist,hostname from musicplaylist where playlistid=".escape($this->filterPlaylist)); 203 if($playlistResult) 204 { 205 if(mysql_num_rows($playlistResult)==1) 206 { 207 $row=mysql_fetch_row($playlistResult); 208 if($row) 209 { 210 211 $this->filterSonglist=$row[2]; 212 if($prevFilter==1) 213 $this->filter=$this->filter . "and song_id in (" . $this->filterSonglist . ")"; 214 else 215 { 216 $this->filter="song_id in (" . $this->filterSonglist . ")"; 217 $prevFilter=1; 218 } 219 220 $this->keepFilters="&filterPlaylist=" . urlencode($this->filterPlaylist); 221 222 } 223 } 224 } 225 } 226 227 if($this->filterArtist != "_All_" ) 228 { 229 if($prevFilter==1) 230 $this->filter=$this->filter . "and artist_name=".escape($this->filterArtist); 231 else 232 { 233 $this->filter="artist_name=".escape($this->filterArtist); 234 $prevFilter=1; 235 } 236 237 $this->keepFilters="&filterArtist=" . urlencode($this->filterArtist); 238 239 } 240 if($this->filterAlbum != "_All_") 241 { 242 if($prevFilter==1) 243 { 244 $this->filter= $this->filter . "and album_name=\"" . $this->filterAlbum . "\""; 245 } 246 else 247 { 248 $this->filter="album_name=\"" . $this->filterAlbum . "\""; 249 $prevFilter=1; 250 } 251 $this->keepFilters =$this->keepFilters . "&filterAlbum=" . urlencode($this->filterAlbum) ; 252 253 } 254 if($this->filterGenre != "_All_") 255 { 256 if($prevFilter==1) 257 { 258 $this->filter= $this->filter . "and genre=" . $this->filterGenre ; 259 } 260 else 261 { 262 $this->filter="genre=\"" . $this->filterGenre . "\""; 263 $prevFilter=1; 264 } 265 $this->keepFilters =$this->keepFilters . "&filterGenre=" . urlencode($this->filterGenre); 266 267 } 268 269 if($this->filterRank != "_All_") 270 { 271 if($prevFilter==1) 272 { 273 $this->filter=$this->filter . "and rank=" . $this->filterRank; 274 } 275 else 276 { 277 $this->filter="rank=" . $this->filterRank; 278 $prevFilter=1; 279 } 280 $this->keepFilters =$this->keepFilters . "&filterRank=" . urlencode($this->filterRank); 281 } 282 283 284 285 } 286 287 function init($maxPerPage) { 288 global $db; 289 $this->prepFilter(); 290 if (empty($this->filter)) 291 $this->totalCount = $db->query_col('SELECT COUNT(*) FROM music_songs'); 292 else 293 $this->totalCount = $db->query_col('SELECT COUNT(*) FROM ((music_songs INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id) INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN music_genres ON music_songs.genre_id = music_genres.genre_id WHERE '.$this->filter); 294 if ($this->totalCount > 0) { 295 if($this->offset > 0) { 296 $limitText='LIMIT ' . $this->offset . ',' . $maxPerPage; 297 } 298 else 299 $limitText='LIMIT ' . $maxPerPage; 300 301 if (empty($this->filter)) 302 303 $this->result=mysql_query("SELECT music_songs.song_id, music_artists.artist_name, music_albums.album_name, music_songs.name, music_genres.genre, music_songs.length, music_songs.rating, music_songs.filename FROM ((music_songs INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id) INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN music_genres ON music_songs.genre_id = music_genres.genre_id order by artist_name,album_name,track " . $limitText); 304 //$this->result=mysql_query("select intid,artist,album,title,genre,length,rating,filename from music_songs order by artist,album,tracknum " . $limitText); 305 else 306 $this->result=mysql_query("SELECT music_songs.song_id, music_artists.artist_name, music_albums.album_name, music_songs.name, music_genres.genre, music_songs.length, music_songs.rating, music_songs.filename FROM ((music_songs INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id) INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN music_genres ON music_songs.genre_id = music_genres.genre_id where $this->filter order by artist_name,album_name,track " . $limitText); 307 //$this->result=mysql_query("select intid,artist,album,title,genre,length,rating,filename from music_songs where $this->filter order by artist,album,tracknum $limitText"); 308 } 309 } 310 } 311 312 -
mythweb/modules/music/mp3act_sajax.php
Property changes on: mythweb/modules/music/music_handler.php ___________________________________________________________________ Name: svn:executable + *
1 <?php 2 if (!isset($SAJAX_INCLUDED)) { 3 4 /* 5 * GLOBALS AND DEFAULTS 6 * 7 */ 8 $sajax_debug_mode = 0; 9 $sajax_export_list = array(); 10 $sajax_request_type = "GET"; 11 $sajax_remote_uri = ""; 12 13 /* 14 * CODE 15 * 16 */ 17 18 // 19 // Initialize the Sajax library. 20 // 21 function sajax_init() { 22 } 23 24 // 25 // Helper function to return the script's own URI. 26 // 27 function sajax_get_my_uri() { 28 global $REQUEST_URI; 29 30 return $REQUEST_URI; 31 } 32 $sajax_remote_uri = sajax_get_my_uri(); 33 34 // 35 // Helper function to return an eval()-usable representation 36 // of an object in JavaScript. 37 // 38 function sajax_get_js_repr($value) { 39 $type = gettype($value); 40 41 if ($type == "boolean" || 42 $type == "integer") { 43 return "parseInt($value)"; 44 } 45 elseif ($type == "double") { 46 return "parseFloat($value)"; 47 } 48 elseif ($type == "array" || $type == "object" ) { 49 // 50 // XXX Arrays with non-numeric indices are not 51 // permitted according to ECMAScript, yet everyone 52 // uses them.. We'll use an object. 53 // 54 $s = "{ "; 55 if ($type == "object") { 56 $value = get_object_vars($value); 57 } 58 foreach ($value as $k=>$v) { 59 $esc_key = sajax_esc($k); 60 if (is_numeric($k)) 61 $s .= "$k: " . sajax_get_js_repr($v) . ", "; 62 else 63 $s .= "\"$esc_key\": " . sajax_get_js_repr($v) . ", "; 64 } 65 return substr($s, 0, -2) . " }"; 66 } 67 else { 68 $esc_val = sajax_esc($value); 69 $s = "\"$esc_val\""; 70 return $s; 71 } 72 } 73 74 function sajax_handle_client_request() { 75 global $sajax_export_list; 76 77 $mode = ""; 78 79 if (! empty($_GET["rs"])) 80 $mode = "get"; 81 82 if (!empty($_POST["rs"])) 83 $mode = "post"; 84 85 if (empty($mode)) 86 return; 87 88 $target = ""; 89 90 if ($mode == "get") { 91 // Bust cache in the head 92 header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 93 header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 94 // always modified 95 header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 96 header ("Pragma: no-cache"); // HTTP/1.0 97 $func_name = $_GET["rs"]; 98 if (! empty($_GET["rsargs"])) 99 $args = $_GET["rsargs"]; 100 else 101 $args = array(); 102 } 103 else { 104 $func_name = $_POST["rs"]; 105 if (! empty($_POST["rsargs"])) 106 $args = $_POST["rsargs"]; 107 else 108 $args = array(); 109 } 110 111 if (! in_array($func_name, $sajax_export_list)) 112 echo "-:$func_name not callable"; 113 else { 114 echo "+:"; 115 $result = call_user_func_array($func_name, $args); 116 echo "var res = " . sajax_get_js_repr($result) . "; res;"; 117 } 118 exit; 119 } 120 121 function sajax_get_common_js() { 122 global $sajax_debug_mode; 123 global $sajax_request_type; 124 global $sajax_remote_uri; 125 126 $t = strtoupper($sajax_request_type); 127 if ($t != "" && $t != "GET" && $t != "POST") 128 return "// Invalid type: $t.. \n\n"; 129 130 ob_start(); 131 ?> 132 133 // remote scripting library 134 // (c) copyright 2005 modernmethod, inc 135 var sajax_debug_mode = <?php echo $sajax_debug_mode ? "true" : "false"; ?>; 136 var sajax_request_type = "<?php echo $t; ?>"; 137 var sajax_target_id = ""; 138 139 function sajax_debug(text) { 140 if (sajax_debug_mode) 141 alert("RSD: " + text) 142 } 143 function sajax_init_object() { 144 sajax_debug("sajax_init_object() called..") 145 146 var A; 147 try { 148 A=new ActiveXObject("Msxml2.XMLHTTP"); 149 } catch (e) { 150 try { 151 A=new ActiveXObject("Microsoft.XMLHTTP"); 152 } catch (oc) { 153 A=null; 154 } 155 } 156 if(!A && typeof XMLHttpRequest != "undefined") 157 A = new XMLHttpRequest(); 158 if (!A) 159 sajax_debug("Could not create connection object."); 160 return A; 161 } 162 function sajax_do_call(func_name, args) { 163 var i, x, n; 164 var uri; 165 var post_data; 166 var target_id; 167 168 sajax_debug("in sajax_do_call().." + sajax_request_type + "/" + sajax_target_id); 169 target_id = sajax_target_id; 170 if (sajax_request_type == "") 171 sajax_request_type = "GET"; 172 173 uri = "<?php echo $sajax_remote_uri; ?>"; 174 if (sajax_request_type == "GET") { 175 176 if (uri.indexOf("?") == -1) 177 uri += "?rs=" + escape(func_name); 178 else 179 uri += "&rs=" + escape(func_name); 180 uri += "&rst=" + escape(sajax_target_id); 181 uri += "&rsrnd=" + new Date().getTime(); 182 183 for (i = 0; i < args.length-1; i++) 184 uri += "&rsargs[]=" + escape(args[i]); 185 186 post_data = null; 187 } 188 else if (sajax_request_type == "POST") { 189 post_data = "rs=" + escape(func_name); 190 post_data += "&rst=" + escape(sajax_target_id); 191 post_data += "&rsrnd=" + new Date().getTime(); 192 193 for (i = 0; i < args.length-1; i++) 194 post_data = post_data + "&rsargs[]=" + escape(args[i]); 195 } 196 else { 197 alert("Illegal request type: " + sajax_request_type); 198 } 199 200 x = sajax_init_object(); 201 x.open(sajax_request_type, uri, true); 202 203 if (sajax_request_type == "POST") { 204 x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); 205 x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 206 } 207 208 x.onreadystatechange = function() { 209 if (x.readyState != 4) 210 return; 211 212 sajax_debug("received " + x.responseText); 213 214 var status; 215 var data; 216 status = x.responseText.charAt(0); 217 data = x.responseText.substring(2); 218 if (status == "-") 219 alert("Error: " + data); 220 else { 221 if (target_id != "") 222 document.getElementById(target_id).innerHTML = eval(data); 223 else 224 args[args.length-1](eval(data)); 225 } 226 } 227 sajax_debug(func_name + " uri = " + uri + "/post = " + post_data); 228 x.send(post_data); 229 sajax_debug(func_name + " waiting.."); 230 delete x; 231 return true; 232 } 233 234 <?php 235 $html = ob_get_contents(); 236 ob_end_clean(); 237 return $html; 238 } 239 240 function sajax_show_common_js() { 241 echo sajax_get_common_js(); 242 } 243 244 // javascript escape a value 245 function sajax_esc($val) 246 { 247 $val = str_replace("\\", "\\\\", $val); 248 $val = str_replace("\r", "\\r", $val); 249 $val = str_replace("\n", "\\n", $val); 250 return str_replace('"', '\\"', $val); 251 } 252 253 function sajax_get_one_stub($func_name) { 254 ob_start(); 255 ?> 256 257 // wrapper for <?php echo $func_name; ?> 258 259 function x_<?php echo $func_name; ?>() { 260 sajax_do_call("<?php echo $func_name; ?>", 261 x_<?php echo $func_name; ?>.arguments); 262 } 263 264 <?php 265 $html = ob_get_contents(); 266 ob_end_clean(); 267 return $html; 268 } 269 270 function sajax_show_one_stub($func_name) { 271 echo sajax_get_one_stub($func_name); 272 } 273 274 function sajax_export() { 275 global $sajax_export_list; 276 277 $n = func_num_args(); 278 for ($i = 0; $i < $n; $i++) { 279 $sajax_export_list[] = func_get_arg($i); 280 } 281 } 282 283 $sajax_js_has_been_shown = 0; 284 function sajax_get_javascript() 285 { 286 global $sajax_js_has_been_shown; 287 global $sajax_export_list; 288 289 $html = ""; 290 if (! $sajax_js_has_been_shown) { 291 $html .= sajax_get_common_js(); 292 $sajax_js_has_been_shown = 1; 293 } 294 foreach ($sajax_export_list as $func) { 295 $html .= sajax_get_one_stub($func); 296 } 297 return $html; 298 } 299 300 function sajax_show_javascript() 301 { 302 echo sajax_get_javascript(); 303 } 304 305 306 $SAJAX_INCLUDED = 1; 307 } 308 ?> -
mythweb/modules/music/mp3act_js.js.php
Property changes on: mythweb/modules/music/mp3act_sajax.php ___________________________________________________________________ Name: svn:executable + *
1 <?php 2 function music_dir() 3 { 4 return 'http://'.$_SERVER['HTTP_HOST'].root."music/"; 5 } 6 ?> 7 window.onload=function(){ init(); }; 8 9 function init(){ 10 mode = 'streaming'; 11 setPageTitle(); 12 x_viewPlaylist(viewPlaylist_cb); 13 x_playlistInfo(plinfo_cb); 14 setPLTitle(); 15 setCurrentPage(); 16 setControls(); 17 updateBox(page,0); 18 } 19 function empty_cb(new_data){ 20 21 } 22 <?php 23 /* function newWindow(type,id){ 24 if(type == 'add') 25 newwindow = window.open('add.php','addmusic','height=400,width=500,scrollbars=yes,resizable=yes'); 26 else if(type == 'download') 27 newwindow = window.open('download.php?id='+id,'download','height=200,width=350,scrollbars=yes,resizable=yes'); 28 29 if (window.focus) {newwindow.focus()} 30 }*/?> 31 32 function setPageNav(){ 33 //document.getElementById("breadcrumb").innerHTML = prevpage; 34 } 35 36 function switchPage(newpage){ 37 prevpage = page; 38 page = newpage; 39 40 updateBox(page,0); 41 setPageTitle(); 42 setCurrentPage(); 43 //setPageNav(); 44 } 45 46 function switchMode(newmode){ 47 if(newmode == mode){ //do nothing 48 } 49 else{ 50 x_switchMode(newmode,switchMode_cb); 51 } 52 } 53 54 function setPLTitle(){ 55 if(mode == 'streaming') 56 newmode = 'Streaming'; 57 if(mode == 'jukebox') 58 newmode = 'Jukebox'; 59 // newmode = 'Streaming'; 60 document.getElementById("pl_title").innerHTML = newmode + " Playlist"; 61 } 62 63 function viewPlaylist_cb(new_data){ 64 document.getElementById("playlist").innerHTML = new_data; 65 } 66 67 function switchMode_cb(new_data){ 68 mode = new_data; 69 setControls(); 70 setPLTitle(); 71 x_playlistInfo(plinfo_cb); 72 x_viewPlaylist(viewPlaylist_cb); 73 } 74 75 function setCurrentPage(){ 76 var x = document.getElementById('nav'); 77 var y = x.getElementsByTagName('a'); 78 for (var i=0;i<y.length;i++){ 79 y[i].removeAttribute("class"); 80 if(y[i].id == page) 81 y[i].setAttribute('class','c'); 82 } 83 } 84 85 function getDropDown(type,id){ 86 x_getDropDown(type,id,getDropDown_cb); 87 } 88 89 function getDropDown_cb(new_data){ 90 ul = document.getElementById("browse_ul"); 91 ul.innerHTML = new_data; 92 ul.style.display = 'block'; 93 } 94 95 function closeDropDown(){ 96 ul = document.getElementById("browse_ul"); 97 ul.style.display = 'none'; 98 ul.innerHTML = ''; 99 } 100 101 function setControls(){ 102 if(mode=='streaming') 103 document.getElementById("controls").innerHTML = '<div class="current" id="current"> <strong class="right">Streaming Mode Active</strong></div>'; 104 else{ 105 document.getElementById("controls").innerHTML = '<div class="buttons"><a href="#" onclick="play(\'prev\',nowplaying); return false;" title="Previous Song"><img src="img/rew_big.gif" /></a><a href="#" id="play" onclick="play(\'pl\',0); return false;" title="Play Playlist"><img src="img/play_big.gif" /></a><a href="#" id="stop" onclick="play(\'stop\',0); return false;" title="Stop Music"><img src="img/stop_big.gif" /></a><a href="#" onclick="play(\'next\',0); return false;" title="Next Song"><img src="img/ff_big.gif" /></a><br/><!--<img src="img/vol.gif" />--></div><div class="current" id="current"><span id="artist"></span><span id="song"></span></div>'; 106 refresh(); 107 setTimeout("refresh()", 10000); 108 } 109 } 110 111 function savePL(type,data){ 112 if(type=='open'){ 113 var save_form = "<h2>Save Playlist</h2><form onsubmit='return savePL(\"save\",this)' method='get' action=''><strong>Playlist Name</strong><br/><input type='text' name='save_pl_name' id='save_pl_name' size='25' /><input style='left: 350px; position: absolute;' type='submit' value='save new' /></form>"; 114 save_form = save_form + "<form onsubmit='return savePL(\"saveold\",this)' method='get' action=''><hr><strong>overwrite Playlist: </strong></ br><select name='overwrite_pl_name'>"; 115 <?php 116 $query = "SELECT playlist_name,hostname FROM music_saved_playlists;"; 117 $result = mysql_query($query); 118 while($row = mysql_fetch_array($result)){ 119 if ($row[1] == "") 120 echo "save_form = save_form + \"<option>".$row[playlist_name]."</option>\";"; 121 else 122 echo "save_form = save_form + \"<option>".$row[0]."@".$row[1]."</option>\";"; 123 } 124 ?> 125 save_form = save_form + " </select> <input style='left: 350px; position: absolute;' type='submit' value='save' /><br><hr><br><input style='left: 400px; position: absolute;' type='button' onclick=\"savePL('close',0); return false;\" value='cancel' /></form> "; 126 document.getElementById("box_extra").innerHTML = save_form; 127 document.getElementById("box_extra").style.display = 'block'; 128 } 129 else if(type=='save'){ 130 var pl_name = data.save_pl_name.value; 131 x_savePlaylist(pl_name,0,save_Playlist_cb); 132 133 return false; 134 } 135 else if(type=='saveold'){ 136 var ov_pl_name = data.overwrite_pl_name.value; 137 x_savePlaylist(ov_pl_name,1,save_Playlist_cb); 138 139 return false; 140 } 141 else if(type=='close') 142 document.getElementById("box_extra").style.display = 'none'; 143 } 144 145 function save_Playlist_cb(new_data){ 146 box = document.getElementById("box_extra"); 147 box.innerHTML = new_data; 148 setTimeout("box.style.display='none'","1250"); 149 } 150 151 function movePLItem(direction,item){ 152 var y; 153 var temp; 154 if(direction == "up") 155 y = item.previousSibling; 156 else if(direction == "down") 157 y = item.nextSibling; 158 159 if(y && y.nodeName == 'LI'){ 160 pl_move(y.id,item.id); 161 162 var temp = y.innerHTML; 163 y.innerHTML = item.innerHTML; 164 item.innerHTML = temp; 165 Fat.fade_element(y.id,null,900,'#ffcc99','#f3f3f3'); 166 } 167 } 168 169 function setBgcolor(id, c) 170 { 171 if(id != ('pl'+nowplaying)){ 172 var o = document.getElementById(id); 173 o.style.backgroundColor = c; 174 } 175 } 176 177 function refresh_cb(new_data) { 178 if(new_data[0] == 1){ 179 } 180 else{ 181 document.getElementById("current").innerHTML = new_data[0]; 182 isplaying = new_data[2]; 183 if(new_data[1] > 0){ 184 185 // highlight current song 186 oldsong = nowplaying; 187 nowplaying = new_data[1]; 188 if(oldsong != 0 && oldsong != new_data[1]){ 189 var old = document.getElementById('pl'+oldsong); 190 old.removeAttribute('class'); 191 Fat.fade_element('pl'+oldsong,null,null,'#96D1EF','#f3f3f3'); 192 193 Fat.fade_element('pl'+new_data[1],null,1400,'#f3f3f3','#96D1EF'); 194 } 195 var current = document.getElementById('pl'+new_data[1]); 196 197 current.setAttribute('class','currentplay'); 198 document.getElementById('stop').style.display = 'inline'; 199 document.getElementById('play').style.display = 'none'; 200 201 }else if(nowplaying!=0 && isplaying==0){ 202 document.getElementById('pl'+nowplaying).removeAttribute('class'); 203 Fat.fade_element('pl'+nowplaying,null,null,'#96D1EF','#f3f3f3'); 204 nowplaying = 0; 205 document.getElementById('stop').style.display = 'none'; 206 document.getElementById('play').style.display = 'inline'; 207 } 208 else if(isplaying==0){ 209 document.getElementById('stop').style.display = 'none'; 210 document.getElementById('play').style.display = 'inline'; 211 } 212 else if(isplaying==1){ 213 document.getElementById('stop').style.display = 'inline'; 214 document.getElementById('play').style.display = 'none'; 215 } 216 } 217 setTimeout("refresh()", 20000); 218 } 219 220 function refresh(){ 221 if(mode=='jukebox'){ 222 var artist = document.getElementById("artist").innerHTML; 223 var song = document.getElementById("song").innerHTML; 224 x_getCurrentSong(artist,song,refresh_cb); 225 } 226 } 227 228 function setPageTitle(){ 229 var pages= new Array() 230 pages["browse"]="Browse Music"; 231 pages["search"]="Search Music"; 232 pages["prefs"]="User Account Preferences"; 233 pages["random"]="Create a Random Mix"; 234 pages["playlists"]="Load a Saved Playlist"; 235 pages["stats"]="Server Statistics"; 236 pages["admin"]="mp3act Administration"; 237 pages["about"]="About mp3act"; 238 document.getElementById("pagetitle").innerHTML = pages[page]; 239 240 } 241 242 function getRandItems(type){ 243 document.getElementById("breadcrumb").innerHTML = ''; 244 x_getRandItems(type,getRandItems_cb); 245 } 246 247 function getRandItems_cb(new_data){ 248 document.getElementById("rand_items").innerHTML = new_data; 249 } 250 251 function updateBox_cb(new_data){ 252 document.getElementById("info").innerHTML = new_data; 253 document.getElementById("loading").style.display = 'none'; 254 255 if(clearbc==1) 256 breadcrumb(); 257 clearbc = 1; 258 259 } 260 261 function updateBox(type,itemid){ 262 document.getElementById("loading").style.display = 'block'; 263 x_musicLookup(type,itemid,updateBox_cb); 264 265 if(type == 'genre' || type == 'letter'){ 266 bc_parenttype = ''; 267 bc_parentitem = ''; 268 } 269 else if(type == 'album' || (type == 'artist' && bc_parenttype != '')){ 270 if(bc_childtype == 'all'){ 271 bc_parenttype = bc_childtype; 272 bc_parentitem = bc_childitem; 273 } 274 } 275 else if(type == 'browse' || type == 'search' || type == 'about' || type == 'prefs' || type == 'random' || type == 'admin' || type == 'playlists' || type == 'stats'){ 276 277 bc_parenttype = ''; 278 bc_parentitem = ''; 279 itemid=''; 280 type=''; 281 } 282 else{ 283 bc_parenttype = bc_childtype; 284 bc_parentitem = bc_childitem; 285 } 286 287 bc_childitem = itemid; 288 bc_childtype = type; 289 290 291 292 293 } 294 295 function deletePlaylist(id){ 296 if(confirm("Are you sure you want to DELETE THIS SAVED PLAYLIST?")){ 297 x_deletePlaylist(id,deletePlaylist_cb); 298 } 299 } 300 301 function deletePlaylist_cb(new_data){ 302 // reload saved PL page 303 clearbc = 0; 304 x_musicLookup('playlists',0,updateBox_cb); 305 setMsgText("Saved Playlist Successfully Deleted"); 306 } 307 308 function plrem(item){ 309 x_playlist_rem(item,plrem_cb); 310 } 311 312 function plrem_cb(rem){ 313 p = document.getElementById("playlist"); 314 d_nested = document.getElementById(rem); 315 throwaway_node = p.removeChild(d_nested); 316 x_playlistInfo(plinfo_cb); 317 } 318 319 function pladd(type,id){ 320 x_playlist_add(type,id,pladd_cb); 321 } 322 323 function pladd_cb(new_data){ 324 325 if(new_data[0] == 1){ 326 x_viewPlaylist(viewPlaylist_cb); 327 x_playlistInfo(plinfo_cb); 328 } 329 else{ 330 document.getElementById("playlist").innerHTML += new_data[0]; 331 332 for(var i=2; i<new_data[1]+2; i++){ 333 Fat.fade_element(new_data[i],null,1400,'#B4EAA2','#f3f3f3'); 334 } 335 x_playlistInfo(plinfo_cb); 336 } 337 } 338 339 function pl_move(item1,item2){ 340 x_playlist_move(item1,item2,pl_move_cb); 341 } 342 343 function pl_move_cb(){ 344 // do nothing 345 } 346 347 function plclear(){ 348 x_clearPlaylist(plinfo_cb); 349 document.getElementById("playlist").innerHTML = ""; 350 } 351 352 function plinfo_cb(new_data){ 353 document.getElementById("pl_info").innerHTML = new_data; 354 } 355 356 function breadcrumb(){ 357 x_buildBreadcrumb(page,bc_parenttype,bc_parentitem,bc_childtype,bc_childitem,breadcrumb_cb); 358 } 359 360 function breadcrumb_cb(new_data){ 361 //if(new_data!="") 362 document.getElementById("breadcrumb").innerHTML = new_data; 363 } 364 365 function play(type,id){ 366 //alert (mode); 367 if(mode == 'streaming'){ 368 document.getElementById('hidden').src = null; 369 document.getElementById("hidden").src = "<?php echo music_dir(); ?>mp3act_hidden.php?type="+type+"&id="+id; 370 //alert(document.getElementById("hidden").src); 371 } 372 else{ 373 x_play(mode,type,id,play_cb); 374 } 375 } 376 377 function randPlay(data){ 378 379 var type = data.random_type.value; 380 if(type == ""){ 381 setMsgText("You must choose a random type"); 382 return false; 383 } 384 var num=0; 385 if(mode == 'streaming') 386 num = data.random_count.value; 387 var items =''; 388 if(type != 'all'){ 389 for(var i=0;i<data.random_items.options.length;i++){ 390 if(data.random_items.options[i].selected == true) 391 items += data.random_items.options[i].value+" "; 392 } 393 394 if(items == ""){ 395 setMsgText("You must choose at least one random item"); 396 return false; 397 } 398 } 399 if(mode == 'streaming'){ 400 document.getElementById('hidden').src = null; 401 document.getElementById("hidden").src = "<?php echo music_dir(); ?>mp3act_hidden.php?type="+type+"&num="+num+"&items="+items; 402 } 403 else{ 404 x_randPlay(mode,type,num,items,play_cb); 405 } 406 return false; 407 408 } 409 410 function play_cb(new_data){ 411 refresh(); 412 } 413 414 function showAlbumArt(mode){ 415 document.getElementById('bigart').style.display = mode; 416 } 417 418 function download(id){ 419 document.getElementById('hidden').src = null; 420 document.getElementById("hidden").src = "<?php echo music_dir(); ?>mp3act_hidden.php?type=dl"+"&id="+id; 421 } 422 423 function addmusic(form){ 424 document.getElementById("current").innerHTML = form.musicpath.value; 425 return false; 426 } 427 428 function adminAddUser(form){ 429 document.getElementById("breadcrumb").innerHTML = ""; 430 431 if(form!=""){ 432 if(form.firstname.value == '' || form.lastname.value == '' || form.username.value == '' || form.password.value == '' || form.password2.value == '' || form.email.value == ''){ 433 setMsgText("Required Fields Are Empty"); 434 return false; 435 } 436 437 if(form.password.value != form.password2.value){ 438 setMsgText("Password Do Not Match"); 439 document.getElementById("password").value = ""; 440 document.getElementById("password2").value = ""; 441 return false; 442 } 443 if(form.email.value.indexOf(".") <= 2 && form.email.value.indexOf("@") <= 0){ 444 setMsgText("Email Address is Invalid"); 445 document.getElementById("email").focus(); 446 return false; 447 } 448 x_adminAddUser(form.firstname.value,form.lastname.value,form.username.value,form.email.value,form.perms.value,form.password.value,adminAddUser_cb); 449 return false; 450 451 } 452 else{ 453 x_adminAddUser('','','','','','',updateBox_cb); 454 } 455 456 457 return false; 458 } 459 460 function adminAddUser_cb(new_data){ 461 clearbc=0; 462 if(new_data==1){ 463 updateBox('admin',0); 464 setMsgText("User Successfully Added"); 465 }else{ 466 setMsgText("Username is Already Taken. Try Another."); 467 document.getElementById("username").value = ""; 468 document.getElementById("username").focus(); 469 } 470 } 471 472 function adminEditUsers(user,action,form){ 473 document.getElementById("breadcrumb").innerHTML = ""; 474 if(user!=0){ 475 if(action == 'del'){ 476 if(confirm('Are you Sure you want to DELETE THE USER?')){ 477 x_adminEditUsers(user,action,adminEditUsers_cb); 478 } 479 480 } 481 else if(action == 'mod'){ 482 x_adminEditUsers(user,'mod',form.active.value,form.perms.value,adminEditUsers_cb); 483 }else{ 484 x_adminEditUsers(user,'user',updateBox_cb); 485 } 486 } 487 else{ 488 x_adminEditUsers(updateBox_cb); 489 } 490 return false; 491 } 492 493 function adminEditUsers_cb(new_data){ 494 clearbc=0; 495 x_adminEditUsers(updateBox_cb); 496 if(new_data==1){ 497 setMsgText("User Successfully Deleted"); 498 499 } 500 if(new_data==2){ 501 setMsgText("User Successfully Updated"); 502 } 503 } 504 505 function setMsgText(text){ 506 document.getElementById("breadcrumb").innerHTML = "<span class='error'>"+text+"</span>"; 507 Fat.fade_element('breadcrumb',null,2000,'#F5C2C2','#ffffff'); 508 } 509 510 function editSettings_cb(new_data){ 511 if(new_data == 1){ 512 clearbc = 0; 513 updateBox('admin',0); 514 setMsgText("New Settings Saved"); 515 } 516 } 517 518 function editSettings(form){ 519 if(form != 0){ 520 x_editSettings(1,form.invite.value,form.downloads.value,form.amazonid.value,form.upload_path.value,form.sample_mode.value,form.mp3bin.value,form.lamebin.value,form.phpbin.value,editSettings_cb); 521 } 522 else{ 523 x_editSettings(0,'','','','','','','','',updateBox_cb); 524 } 525 return false; 526 } 527 528 function editUser_cb(new_data){ 529 if(new_data == 1){ 530 clearbc = 0; 531 updateBox('prefs',0); 532 533 setMsgText("New Settings Saved"); 534 } 535 536 } 537 538 function editUser(type,form){ 539 if(form != 0){ 540 if(type == 'info'){ 541 x_editUser(type,form.firstname.value,form.lastname.value,form.email.value,0,'','','',editUser_cb); 542 } 543 else if(type == 'settings'){ 544 x_editUser(type,form.default_playmode.value,form.default_bitrate.value,form.default_stereo.value,form.theme_id.value,form.as_username.value,form.as_password.value,form.as_type.value,editUser_cb); 545 } 546 else if(type == 'pass'){ 547 if(form.new_password.value != form.new_password2.value){ 548 setMsgText("New Passwords Do Not Match"); 549 }else{ 550 document.getElementById("breadcrumb").innerHTML = ""; 551 x_editUser(type,form.old_password.value,form.new_password.value,'',0,'','','',editUser_cb); 552 } 553 } 554 }else{ 555 x_editUser(type,'','','',0,'','','',updateBox_cb); 556 } 557 return false; 558 } 559 560 function searchMusic(form){ 561 if(form.searchbox.value == '' || form.searchbox.value == '[enter your search terms]'){ 562 setMsgText("You Must Enter Something to Search For"); 563 } 564 else{ 565 document.getElementById("breadcrumb").innerHTML = ""; 566 x_searchMusic(form.searchbox.value,form.search_options.value,updateBox_cb); 567 } 568 return false; 569 } 570 571 function clearDB_cb(new_data){ 572 if(new_data == 1) 573 setMsgText("Database Successfully Cleared"); 574 } 575 576 function clearDB(){ 577 if(confirm("Are you sure you want to RESET THE MUSIC DATABASE? This will remove all data regarding music and music stastics.")){ 578 x_resetDatabase(clearDB_cb); 579 } 580 } 581 582 function sendInvite(form){ 583 x_createInviteCode(form.email.value,sendInvite_cb); 584 return false; 585 } 586 587 function sendInvite_cb(new_data){ 588 if(new_data == 1){ 589 setMsgText("Invitation Successfully Sent"); 590 document.getElementById("email").value = ""; 591 } 592 } 593 594 function submitScrobbler(userid){ 595 x_submitScrobbler(userid,empty_cb); 596 setMsgText("AudioScrobbler Submission Attempted"); 597 return false; 598 } 599 No newline at end of file -
mythweb/modules/music/mp3act_functions.php
Property changes on: mythweb/modules/music/mp3act_js.js.php ___________________________________________________________________ Name: svn:executable + *
1 <?php 2 /****************************************** 3 * mp3act functions 4 * http://www.mp3act.net 5 * Stripped, because not all this funcionality is needed in MythWEB 6 * 7 ******************************************/ 8 function pic_dir() 9 { 10 return 'http://'.$_SERVER['HTTP_HOST'].skin_url.'img/music/'; 11 } 12 13 function music_dir() 14 { 15 return 'http://'.$_SERVER['HTTP_HOST'].root."music/"; 16 } 17 18 function mp3act_connect() { 19 return 1; 20 } 21 22 function switchMode($mode){ 23 $_SESSION['sess_playmode'] = $mode; 24 return $mode; 25 } 26 27 function setCurrentSong($song_id,$pl_id,$rand=0){ 28 mp3act_connect(); 29 $query = "DELETE FROM music_currentsong"; 30 mysql_query($query); 31 $query = "INSERT INTO music_currentsong VALUES ($song_id,$pl_id,$rand)"; 32 mysql_query($query); 33 } 34 35 function getCurrentSong($curArtist, $curSong){ 36 $data = array(); 37 38 mp3act_connect(); 39 $query = "SELECT music_currentsong.random,music_currentsong.pl_id,music_artists.artist_name,music_artists.prefix, music_songs.name FROM music_artists,music_songs,music_currentsong WHERE music_currentsong.song_id=music_songs.song_id AND music_songs.artist_id=music_artists.artist_id"; 40 $result = mysql_query($query); 41 if(mysql_num_rows($result) == 0){ 42 $data[] = "<strong>No Songs Playing</strong><span id='artist'></span><span id='song'></span>"; 43 $data[] = 0; 44 $data[] = 0; 45 return $data; 46 } 47 $row = mysql_fetch_array($result); 48 if($row['artist_name'] == $curArtist && $row['name'] == $curSong){ 49 $data[] = 1; 50 $data[] = $row['pl_id']; 51 $data[] = 1; 52 return $data; 53 } 54 55 $data[] = "<strong>Currently Playing".($row['random'] ? " (Random Mix)" : "")."</strong><br/><span id='artist'>$row[prefix] $row[artist_name]</span><br/><span id='song'>$row[name]</span>\n"; 56 $data[] = $row['pl_id']; 57 $data[] = 1; 58 return $data; 59 } 60 61 62 function genreform(){ 63 mp3act_connect(); 64 $query = "SELECT * FROM music_genres ORDER BY genre"; 65 $result = mysql_query($query); 66 67 $output = "<select id=\"genre\" name=\"genre\" onchange=\"updateBox('genre',this.options[selectedIndex].value); return false;\"> 68 <option value=\"\" selected>Choose Genre.."; 69 70 while($genre = mysql_fetch_array($result)){ 71 $output .= " <option value=\"$genre[genre]\">$genre[genre]\n"; 72 } 73 $output .= "</select>"; 74 75 return $output; 76 } 77 78 function letters(){ 79 $output = "<ul class=\"music\" id=\"letters\">"; 80 $letters = array('#','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); 81 82 foreach($letters as $letter){ 83 $output .= "<li><a class=music href=\"#\" onclick=\"updateBox('letter','$letter'); return false;\">".strtoupper($letter)."</a></li>\n"; 84 } 85 $output .= "</ul>"; 86 return $output; 87 } 88 89 function getDropDown($type, $id){ 90 $dropdown = ""; 91 return $dropdown; 92 } 93 94 function buildBreadcrumb($page,$parent,$parentitem,$child,$childitem){ 95 mp3act_connect(); 96 $childoutput=''; 97 $parentoutput =''; 98 if($page == 'browse' && $child != ''){ 99 $output = "<a class=music href=\"#\" onclick=\"updateBox('browse',0); return false;\">Browse</a> » "; 100 } 101 switch($child){ 102 case 'album': 103 $query = "SELECT music_albums.album_name,music_artists.artist_name,music_artists.artist_id,music_artists.prefix FROM music_albums,music_artists WHERE music_albums.artist_id=music_artists.artist_id AND music_albums.album_id=$childitem"; 104 $result = mysql_query($query); 105 $row = mysql_fetch_array($result); 106 $albums = ''; 107 $query = "SELECT album_name,album_id FROM music_albums WHERE artist_id=$row[artist_id] ORDER BY album_name"; 108 $result = mysql_query($query); 109 while($row2 = mysql_fetch_array($result)){ 110 $albums .= "<li><a class=music href=\"#\" onclick=\"updateBox('album',$row2[album_id]); return false;\" title=\"View Details of $row2[album_name]\">$row2[album_name]</a></li>"; 111 } 112 $childoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('artist'," . $row['artist_id'] . "); return false;\">" . $row['prefix'] . " " . $row['artist_name'] . "</a><ul class=\"music\">$albums</ul></span> » " . htmlentities($row['album_name']); 113 break; 114 case 'artist': 115 $query = "SELECT artist_name,prefix FROM music_artists WHERE artist_id=$childitem"; 116 $result = mysql_query($query); 117 $row = mysql_fetch_array($result); 118 $albums = ''; 119 echo "aa".$childitem."bb"; 120 $query = "SELECT music_albums.album_name, music_albums.album_id FROM music_songs INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id GROUP BY music_albums.album_name, music_albums.album_id, music_songs.artist_id HAVING (((music_songs.artist_id)=$childitem));"; 121 //$query = "SELECT album_name,album_id FROM music_albums WHERE artist_id=$childitem ORDER BY album_name"; 122 $result = mysql_query($query); 123 while($row2 = mysql_fetch_array($result)){ 124 $albums .= "<li><a class=music href=\"#\" onclick=\"updateBox('album',$row2[album_id]); return false;\" title=\"View Details of $row2[album_name]\">$row2[album_name]</a></li>"; 125 } 126 $childoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('artist',$childitem); return false;\">$row[prefix] $row[artist_name]</a><ul class=\"music\">$albums</ul></span>"; 127 break; 128 case 'letter': 129 $childoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('letter','$childitem'); return false;\">".strtoupper($childitem)."</a>".letters()."</span>"; 130 break; 131 case 'genre': 132 $childoutput .= $childitem; 133 break; 134 case 'all': 135 $childoutput .= $childitem; 136 break; 137 138 } 139 switch($parent){ 140 141 case 'letter': 142 $parentoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('letter','$parentitem'); return false;\">".strtoupper($parentitem)."</a>".letters()."</span> » "; 143 break; 144 case 'genre': 145 $query = "SELECT album_name FROM music_albums WHERE album_id=$childitem"; 146 $result = mysql_query($query); 147 $row = mysql_fetch_array($result); 148 $parentoutput .= "<a class=music href=\"#\" onclick=\"updateBox('genre','$parentitem'); return false;\">$parentitem</a> » "; 149 break; 150 case 'all': 151 $parentoutput .= "<a class=music href=\"#\" onclick=\"updateBox('all','$parentitem'); return false;\">$parentitem</a> » "; 152 break; 153 154 } 155 if (isset($output)) { 156 return $output.$parentoutput.$childoutput; 157 } else { 158 return ''; 159 } 160 } 161 162 function musicLookup($type,$itemid){ 163 mp3act_connect(); 164 switch($type){ 165 case 'browse': 166 $output = "<div class=\"head\">"; 167 $output .= "<h2 class=music>Browse the Music Database</h2></div>"; 168 $output .= "<p>"; 169 $output .= "<strong>By Artist Beginning With</strong><br/>".letters()."<br/></p>\n"; 170 $output .= "<p><strong>By Genre</strong><br/>\n"; 171 $output .= genreForm()."<br/><br/>\n"; 172 $output .= "<input type='button' value='Browse All Albums' onclick=\"updateBox('all','All'); return false;\" class='btn2' />\n"; 173 $output .= "</p>\n"; 174 175 break; 176 case 'search': 177 $output = "<div class=\"head\">"; 178 $output .= "<h2 class=music>Search the Music Database</h2></div>"; 179 $output .= "<form onsubmit='return searchMusic(this)' method='get' action=''>\n"; 180 $output .= "<p> 181 <strong>Keywords</strong><br/> 182 <input type='text' onfocus='this.select()' name='searchbox' size='35' id='searchbox' value='[enter your search terms]' /> 183 <br/><br/> 184 <strong>Narrow Your Search</strong> 185 <br/> 186 <select name='search_options' size='1'> 187 <option value='all'>All Fields</option> 188 <option value='artists'>Artists</option> 189 <option value='albums'>Albums</option> 190 <option value='songs'>Songs</option> 191 </select><br/><br/> 192 <input type='submit' value='submit search' class='btn' /></form>"; 193 $output .= "</p>\n"; 194 195 break; 196 case 'letter': 197 if($itemid == "#"){ 198 $query = "SELECT * FROM music_artists 199 WHERE artist_name 200 LIKE '0%' 201 OR artist_name LIKE '1%' 202 OR artist_name LIKE '2%' 203 OR artist_name LIKE '3%' 204 OR artist_name LIKE '4%' 205 OR artist_name LIKE '5%' 206 OR artist_name LIKE '6%' 207 OR artist_name LIKE '7%' 208 OR artist_name LIKE '8%' 209 OR artist_name LIKE '9%' 210 ORDER BY artist_name"; 211 }else{ 212 $query = "SELECT * FROM music_artists 213 WHERE artist_name LIKE '$itemid%' 214 ORDER BY artist_name"; 215 } 216 $result = mysql_query($query); 217 $output = "<div class=\"head\">"; 218 $output .= "<h2 class=music>Artists Beginning with '".strtoupper($itemid)."'</h2></div>"; 219 $output .= "<p> 220 <strong>Artist Listing</strong></p> 221 <ul class=\"music\">"; 222 $count =1; 223 while($row = mysql_fetch_array($result)){ 224 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 225 $output .= "<li $alt><a class=music href=\"#\" onclick=\"updateBox('artist',$row[artist_id]); return false;\" title=\"View Albums for $row[prefix] $row[artist_name]\">$row[prefix] $row[artist_name]</a></li>\n"; 226 $count++; 227 } 228 $output .= "</ul>\n"; 229 230 break; 231 232 case 'all': 233 $output = "<div class=\"head\">"; 234 //$output .= "<div class=\"right\"><a class=music href='#' onclick=\"updateBox('all',$itemid-30); return false;\">Prev Page</a> <a class=music href='#' onclick=\"updateBox('all',$itemid+30); return false;\">Next Page</a> </div>"; 235 $output .= "<h2 class=music>All Albums</h2></div> "; 236 $output .= "<p> 237 <strong>Allbum Listing</strong></p> 238 <ul class=\"music\">"; 239 $start = $itemid; 240 $query = "SELECT music_artists.artist_name,music_artists.prefix,music_albums.* FROM music_albums,music_artists WHERE music_albums.artist_id=music_artists.artist_id ORDER BY artist_name,album_name"; /* LIMIT $start,30"; */ 241 $result = mysql_query($query); 242 $count = 1; 243 while($row = mysql_fetch_array($result)){ 244 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 245 $output .= "<li $alt><a class=music href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"Add Album to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\"><img src=\"".pic_dir()."play.gif\" /></a> <a class=music href=\"#\" onclick=\"updateBox('album'," . $row['album_id'] . "); return false;\" title=\"View Details of " . $row['album_name'] . "\">" . $row['prefix'] . " " . $row['artist_name'] . " - " . $row['album_name'] . " " . (($row['album_year'] != 0) ? ("<em>(" . $row['album_year'] . ")</em>") : ("")) . "</a></li>\n"; 246 247 $count++; 248 } 249 $output .= "</ul>\n"; 250 break; 251 252 case 'album': 253 //$query = "SELECT music_albums.*,music_artists.artist_name,music_artists.prefix,COUNT(music_songs.song_id) as tracks,SEC_TO_TIME(SUM(music_songs.length)) as time FROM music_albums,music_artists,music_songs WHERE music_albums.album_id=$itemid AND music_albums.artist_id=music_artists.artist_id AND music_songs.album_id=$itemid GROUP BY music_songs.album_id"; 254 $query="SELECT music_albums.*, Count(music_songs.song_id) AS tracks, SEC_TO_TIME(Sum(music_songs.length)) AS time FROM (music_songs INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id GROUP BY music_albums.album_id, music_albums.album_name, music_albums.album_art HAVING (((music_albums.album_id)=$itemid));"; 255 $result = mysql_query($query); 256 $row = mysql_fetch_array($result); 257 258 $album_art=''; 259 260 261 if($row['album_art'] == ""){ 262 $row['album_art'] = art_insert($row['album_id'],$row['artist_name'],$row['album_name']); 263 if($row['album_art'] != ''){ 264 $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/$row[album_art]\" />\n"; 265 } 266 }elseif($row['album_art'] != "fail"){ 267 $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/$row[album_art]\" />\n"; 268 } 269 $output = "<div class=\"head\">"; 270 $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"play('album',".$row['album_id']."); return false;\" title=\"Play this Album Now\">play</a> <a class=music href=\"#\" onclick=\"pladd('album',$row[album_id]); return false;\" title=\"Add Album to Current Playlist\">add</a> "."<a class=music href=\"#\" onclick=\"newWindow('download',$row[album_id]); return false;\" title=\"Download this Album Now\">download</a>"."</div>"; 271 $output .= "<h2 class=music>".$row['album_name']."</h2></div>"; 272 $output .= "<p>$album_art\n"; 273 $output .= " <strong>Tracks:</strong> $row[tracks]<br/>\n"; 274 $output .= (($row['album_year'] != 0) ? ("<strong>Year:</strong> " . $row['album_year'] . "<br/>\n") : ("")); 275 //$output .= " <strong>Genre:</strong> <a class=music href=\"#\" onclick=\"updateBox('genre','$row[album_genre]'); return false;\" title=\"View Artists from $row[album_genre] Genre\">$row[album_genre]</a><br/>\n"; 276 $output .= " <strong>Play Time:</strong> $row[time]\n"; 277 $output .= " <br/><br/>\n"; 278 $output .= " <strong>Album Tracks</strong></p>\n"; 279 $output .= "<ul class=\"music\">\n"; 280 $output .= "<img id='bigart' src=\"art/$row[album_art]\" />\n"; 281 $query = "SELECT music_songs.*,SEC_TO_TIME(music_songs.length) as length , music_artists.artist_name FROM music_songs INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id WHERE album_id=$itemid ORDER BY track"; 282 $result = mysql_query($query); 283 $count=1; 284 while($row = mysql_fetch_array($result)){ 285 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 286 $output .= "<li $alt ondblclick=\"pladd('song',$row[song_id]); return false;\" ><a class=music href=\"#\" onclick=\"pladd('song',$row[song_id]); return false;\" title=\"Add Song to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('song',$row[song_id]); return false;\" title=\"Play this Song Now\"><img src=\"".pic_dir()."play.gif\" /></a> $row[track]. $row[artist_name] - $row[name]<p>$row[numplays] Plays<br/><em>$row[length]</em></p></li>\n"; 287 $count++; 288 } 289 290 $output .= "</ul>\n"; 291 break; 292 case 'genre': 293 $query = "SELECT music_artists.artist_id,music_artists.artist_name,music_artists.prefix FROM music_artists,music_albums WHERE music_albums.album_genre='$itemid' AND music_artists.artist_id=music_albums.artist_id GROUP BY music_artists.artist_id ORDER BY music_artists.artist_name"; 294 $result = mysql_query($query); 295 $row = mysql_fetch_array($result); 296 297 $output = "<div class=\"head\">"; 298 $output .= "<h2 class=\"music\">Artists for Genre '$itemid'</h2></div>"; 299 $output .= "<p> 300 <strong>Artist Listing</strong></p> 301 <ul class=\"music\">"; 302 303 $result = mysql_query($query); 304 305 $count=1; 306 while($row = mysql_fetch_array($result)){ 307 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 308 $output .= "<li $alt><a class=music href=\"#\" onclick=\"updateBox('artist',$row[artist_id]); return false;\" title=\"View Albums for $row[artist_name]\">$row[prefix] $row[artist_name]</a></li>\n"; 309 $count++; 310 } 311 $output .= "</ul>\n"; 312 break; 313 case 'artist': 314 $query = "SELECT artist_id,artist_name,prefix FROM music_artists WHERE artist_id=$itemid"; 315 $result = mysql_query($query); 316 $row = mysql_fetch_array($result); 317 318 319 $artist = $row[artist_name]; 320 321 $output = "<div class=\"head\">"; 322 $output .= "<h2 class=\"music\">$row[prefix] $row[artist_name] </h2></div>"; 323 $output .= "<p>\n"; 324 $output .= "<strong>Songs</strong></p>\n"; 325 $output .= "<ul class=\"music\">\n"; 326 327 $query = "SELECT music_songs.*,SEC_TO_TIME(music_songs.length) as length , music_artists.artist_name FROM music_songs INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id WHERE music_songs.artist_id=$itemid;"; 328 $result = mysql_query($query); 329 $count=1; 330 while($row = mysql_fetch_array($result)){ 331 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 332 $output .= "<li $alt ondblclick=\"pladd('song',$row[song_id]); return false;\" ><a class=music href=\"#\" onclick=\"pladd('song',$row[song_id]); return false;\" title=\"Add Song to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('song',$row[song_id]); return false;\" title=\"Play this Song Now\"><img src=\"".pic_dir()."play.gif\" /></a> $row[name]<p>$row[numplays] Plays<br/><em>$row[length]</em></p></li>\n"; 333 $count++; 334 } 335 $output .= "</ul><br />\n"; 336 337 $output .= "<p>\n"; 338 $output .= "<strong>Album's with songs from <i>$artist</i></strong></p>\n"; 339 $output .= "<ul class=\"music\">\n"; 340 341 $query = "SELECT music_albums.album_name, music_albums.album_id FROM music_songs INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id GROUP BY music_albums.album_name, music_albums.album_id, music_songs.artist_id HAVING (((music_songs.artist_id)=$itemid));"; 342 343 //$query = "SELECT music_albums.* FROM music_albums WHERE music_albums.artist_id=$itemid ORDER BY music_albums.album_name"; 344 $result = mysql_query($query); 345 $count=1; 346 while($row = mysql_fetch_array($result)){ 347 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 348 $output .= "<li $alt><a class=music href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"Add Album to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\"><img src=\"".pic_dir()."play.gif\" /></a> <a class=music href=\"#\" onclick=\"updateBox('album'," . $row['album_id'] . "); return false;\" title=\"View Details of " . $row['album_name'] . "\">" . $row['album_name'] . " " . (($row['album_year'] != 0) ? ("<em>(" . $row['album_year'] . ")</em>") : (""))."</a></li>\n"; 349 $count++; 350 } 351 $output .= "</ul>\n"; 352 break; 353 case 'random': 354 $output = "<div class=\"head\">"; 355 $output .= "<h2 class=\"music\">Random Mix Maker</h2></div>"; 356 $output .= "<form onsubmit='return randPlay(this)' method='get' action=''>\n<p>"; 357 //if($_SESSION['sess_playmode'] == "streaming"){ 358 $output .= "<strong>Number of Songs</strong><br/>\n 359 <select name='random_count'> 360 <option value=10>10 </option> 361 <option value=20>20 </option> 362 <option value=30>30 </option> 363 <option value=40>40 </option> 364 <option value=50>50 </option> 365 </select><br/>\n"; 366 // } 367 $output .= "<strong>Random Type</strong><br/>\n 368 <select name='random_type' onchange=\"getRandItems(this.options[selectedIndex].value); return false;\" > 369 <option value='' >Choose Type...</option> 370 <option value='artists' >Artists</option> 371 <option value='genre' >Genre</option> 372 <option value='albums' >Albums</option> 373 <option value='all' >Everything</option> 374 </select><br/>\n"; 375 $output .= "<strong>Random Items</strong>\n<span id='rand_items'></span> 376 <br/><br/>"; 377 $output .= "<input type='submit' value='play mix' class='btn' />"; 378 $output .= "</form></p>\n"; 379 break; 380 case 'playlists': 381 $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM music_saved_playlists"; 382 $result = mysql_query($query); 383 384 $output = "<div class=\"head\">"; 385 $output .= "<h2 class=\"music\">Saved Playlists</h2></div>"; 386 $output .= "<p><strong>Public Playlists</strong></p>\n"; 387 $output .= "<ul class=\"music\">\n"; 388 if(mysql_num_rows($result) == 0) 389 $output .= "No Public Playlists"; 390 while ($row = mysql_fetch_array($result)){ 391 if ($row["hostname"] == "") 392 $output .= "<li><a class=music href=\"#\" onclick=\"pladd('playlist',$row[playlist_id]); return false;\" title='Load this Saved Playlist'><img src=\"".pic_dir()."add.gif\" /></a> "."<a class=music href=\"#\" onclick=\"deletePlaylist($row[playlist_id]); return false;\" title='DELETE this Saved Playlist'><img src=\"".pic_dir()."rem.gif\" /></a>"." <a onclick=\"updateBox('saved_pl',$row[playlist_id]); \" title='Click to View Playlist' href='#'>$row[playlist_name] - $row[songcount] Songs ($row[time2])</a></li>"; 393 else 394 $output .= "<li><a class=music href=\"#\" onclick=\"pladd('playlist',$row[playlist_id]); return false;\" title='Load this Saved Playlist'><img src=\"".pic_dir()."add.gif\" /></a> "."<a class=music href=\"#\" onclick=\"deletePlaylist($row[playlist_id]); return false;\" title='DELETE this Saved Playlist'><img src=\"".pic_dir()."rem.gif\" /></a>"." <a onclick=\"updateBox('saved_pl',$row[playlist_id]); \" title='Click to View Playlist' href='#'>$row[playlist_name] @ $row[hostname] - $row[songcount] Songs ($row[time2])</a></li>"; 395 } 396 $output .= "</ul>\n"; 397 break; 398 case 'saved_pl': 399 $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM music_saved_playlists WHERE playlist_id=$itemid"; 400 $result = mysql_query($query); 401 $row = mysql_fetch_array($result); 402 $output = "<div class=\"head\">"; 403 $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"pladd('playlist',$row[playlist_id]); return false;\" title=\"Load Playlist\">load playlist</a></div>"; 404 405 $output .= "<h2 class=\"music\">View Saved Playlist</h2></div>"; 406 $output .= "<p><strong>Playlist Info</strong><br/>$row[songcount] Songs<br/>$row[time2]</p>\n"; 407 $output .= "<p><strong>Playlist Songs</strong></p>\n"; 408 $output .= "<ul class=\"music\">\n"; 409 $songs = explode(",",$row['playlist_songs']); 410 if (strlen($row['playlist_songs']) != 0) 411 { 412 $count = 0; 413 foreach($songs as $song){ 414 $query = "SELECT music_songs.*,SEC_TO_TIME(music_songs.length) AS length,music_artists.artist_name FROM music_artists,music_songs WHERE music_songs.song_id=$song AND music_artists.artist_id=music_songs.artist_id"; 415 $result = mysql_query($query); 416 $row = mysql_fetch_array($result); 417 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 418 $output .= "<li $alt>$row[artist_name] - $row[name]<p>$row[numplays] Plays<br/><em>$row[length]</em></p></li>"; 419 $count++; 420 } 421 } 422 else 423 $output = " <b>There are no songs in that Playlist!</b>"; 424 $output .= "</ul>\n"; 425 426 break; 427 case 'stats': 428 $query = "SELECT * FROM music_stats"; 429 $result = mysql_query($query); 430 $row = mysql_fetch_array($result); 431 $query = "SELECT COUNT(play_id) AS songs FROM music_playhistory"; 432 $result = mysql_query($query); 433 $row3 = mysql_fetch_array($result); 434 435 $output = "<div class=\"head\">"; 436 $output .= "<h2 class=\"music\">Server Statistics</h2></div>"; 437 $output .= "<p>\n"; 438 $output .= "<a class=music href='#' onclick=\"updateBox('recentadd',0); return false;\" >Recently Added Albums</a><br/>"; 439 $output .= "<a class=music href='#' onclick=\"updateBox('recentplay',0); return false;\" >Recently Played Songs</a><br/>"; 440 $output .= "<a class=music href='#' onclick=\"updateBox('topplay',0); return false;\" >Top Played Songs</a><br/>"; 441 442 443 $output .= "</p>\n"; 444 $output .= "<h3>Local Server Statistics</h3>\n"; 445 $result = mysql_query("SELECT song_id from music_songs;"); 446 $output .= "<p><strong>Songs:</strong> ". mysql_num_rows($result)."<br/>\n"; 447 $result = mysql_query("SELECT album_id from music_albums;"); 448 $output .= "<strong>Albums:</strong> ". mysql_num_rows($result)."<br/>\n"; 449 $result = mysql_query("SELECT artist_id from music_artists;"); 450 $output .= "<strong>Artists:</strong> ". mysql_num_rows($result)."<br/>\n"; 451 $result = mysql_query("SELECT genre_id from music_genres;"); 452 $output .= "<strong>Genres:</strong> ". mysql_num_rows($result)."<br/><br/>\n"; 453 // $output .= "<strong>Total Time:</strong> $row[total_time]<br/>\n"; 454 // $output .= "<strong>Total Size:</strong> $row[total_size]<br/><br/>\n"; 455 $output .= "<strong>Songs Played:</strong> $row3[songs]<br/></p>\n"; 456 457 break; 458 case 'recentadd': 459 $query = "SELECT music_albums.album_name,music_albums.album_id, 460 music_artists.artist_name, 461 DATE_FORMAT(music_songs.date_entered,'%m.%d.%Y') as pubdate 462 FROM music_songs,music_albums,music_artists 463 WHERE music_songs.album_id=music_albums.album_id 464 AND music_artists.artist_id=music_songs.artist_id 465 GROUP BY music_songs.album_id ORDER BY music_songs.date_entered DESC LIMIT 40"; 466 $result = mysql_query($query); 467 468 $output = "<div class=\"head\">"; 469 $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; 470 $output .= "<h2 class=\"music\">Recently Added Albums</h2></div><ul class=\"music\">"; 471 $count=1; 472 while($row = mysql_fetch_array($result)){ 473 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 474 $output .= "<li $alt><small>$row[pubdate]</small> <a class=music href=\"#\" onclick=\"pladd('album',$row[album_id]); return false;\" title=\"Add Album to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('album',$row[album_id]); return false;\" title=\"Play this Album Now\"><img src=\"".pic_dir()."play.gif\" /></a> <a class=music href=\"#\" onclick=\"updateBox('album',$row[album_id]); return false;\" title=\"View Details of $row[album_name]\"><em>$row[artist_name]</em> - $row[album_name]</a></li>"; 475 $count++; 476 } 477 $output .= "</ul>"; 478 479 480 break; 481 case 'topplay': 482 $query = "SELECT music_albums.album_name, music_songs.numplays, music_songs.name, 483 music_artists.artist_name,music_songs.song_id 484 FROM music_songs,music_albums,music_artists 485 WHERE music_songs.album_id=music_albums.album_id 486 AND music_artists.artist_id=music_songs.artist_id 487 AND music_songs.numplays > 0 488 ORDER BY music_songs.numplays DESC LIMIT 40"; 489 $result = mysql_query($query); 490 491 $output = "<div class=\"head\">"; 492 $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; 493 $output .= "<h2 class=\"music\">Top Played Songs</h2></div><ul class=\"music\">"; 494 $count=1; 495 while($row = mysql_fetch_array($result)){ 496 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 497 $output .= "<li $alt><small>$row[numplays] Plays</small> <a class=music href=\"#\" onclick=\"pladd('song',$row[song_id]); return false;\" title=\"Add Song to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('song',$row[song_id]); return false;\" title=\"Play this Song Now\"><img src=\"".pic_dir()."play.gif\" /></a> <em>$row[artist_name]</em> - $row[name]</li>"; 498 $count++; 499 } 500 $output .= "</ul>"; 501 break; 502 case 'recentplay': 503 $query = "SELECT music_songs.name, music_songs.song_id, 504 music_artists.artist_name, 505 DATE_FORMAT(music_playhistory.date_played,'%m.%d.%Y') as playdate 506 FROM music_songs,music_artists,music_playhistory 507 WHERE music_songs.song_id=music_playhistory.song_id 508 AND music_artists.artist_id=music_songs.artist_id 509 ORDER BY music_playhistory.play_id DESC LIMIT 40"; 510 $result = mysql_query($query); 511 512 $output = "<div class=\"head\">"; 513 $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; 514 $output .= "<h2 class=\"music\">Recently Played Songs</h2></div><ul class=\"music\">"; 515 $count=1; 516 while($row = mysql_fetch_array($result)){ 517 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 518 $output .= "<li $alt><small>$row[playdate]</small> <a class=music href=\"#\" onclick=\"pladd('song',$row[song_id]); return false;\" title=\"Add Song to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('song',$row[song_id]); return false;\" title=\"Play this Song Now\"><img src=\"".pic_dir()."play.gif\" /></a> <em>$row[artist_name]</em> - $row[name]</li>"; 519 $count++; 520 } 521 $output .= "</ul>"; 522 523 524 break; 525 } 526 527 return $output; 528 529 } 530 531 function getRandItems($type){ 532 mp3act_connect(); 533 $options = ''; 534 switch($type){ 535 case 'artists': 536 $query = "SELECT * FROM music_artists ORDER BY artist_name"; 537 $result = mysql_query($query); 538 while($row = mysql_fetch_array($result)){ 539 $options .= "<option value=$row[artist_id]>$row[prefix] $row[artist_name]</option>\n"; 540 } 541 break; 542 case 'genre': 543 $query = "SELECT genre_id,genre FROM music_genres ORDER BY genre"; 544 $result = mysql_query($query); 545 while($row = mysql_fetch_array($result)){ 546 $options .= "<option value=$row[genre_id]>$row[genre]</option>\n"; 547 } 548 break; 549 case 'albums': 550 $query = "SELECT music_artists.artist_name,music_artists.prefix,music_albums.album_id,music_albums.album_name FROM music_albums,music_artists WHERE music_albums.artist_id=music_artists.artist_id ORDER BY artist_name,album_name"; 551 $result = mysql_query($query); 552 while($row = mysql_fetch_array($result)){ 553 $options .= "<option value=$row[album_id]>$row[prefix] $row[artist_name] - $row[album_name]</option>\n"; 554 } 555 break; 556 case 'all': 557 return "<br/>All Songs"; 558 break; 559 } 560 561 return "<select name='random_items' multiple size='12' style='width: 90%;'>$options</select>"; 562 563 } 564 565 function searchMusic($terms,$option){ 566 mp3act_connect(); 567 $query="SELECT music_songs.song_id, music_albums.album_name,music_songs.track,music_artists.artist_name,music_artists.prefix,music_songs.name,SEC_TO_TIME(music_songs.length) as length 568 FROM music_songs,music_artists,music_albums WHERE music_songs.artist_id=music_artists.artist_id AND music_albums.album_id=music_songs.album_id AND "; 569 if($option == 'all') 570 $query .= "(music_songs.name LIKE '%$terms%' OR music_artists.artist_name LIKE '%$terms%' OR music_albums.album_name LIKE '%$terms%')"; 571 elseif($option == 'artists') 572 $query .= "(music_artists.artist_name LIKE '%$terms%')"; 573 elseif($option == 'albums') 574 $query .= "(music_albums.album_name LIKE '%$terms%')"; 575 elseif($option == 'songs') 576 $query .= "(music_songs.name LIKE '%$terms%')"; 577 578 $query .= " ORDER BY music_artists.artist_name,music_albums.album_name,music_songs.track"; 579 580 $result = mysql_query($query); 581 $count = mysql_num_rows($result); 582 583 $output = "<div class=\"head\">"; 584 $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('search'); return false;\" title=\"Begin a New Search\">new search</a></div>"; 585 $output .= "<h2 class=\"music\">Found $count Results for '$terms'</h2></div>"; 586 $output .= "<ul class=\"music\">\n"; 587 if($count>0){ 588 $count=1; 589 while($row = mysql_fetch_array($result)){ 590 ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = ''); 591 $output .= "<li $alt><a class=music href=\"#\" onclick=\"pladd('song',$row[song_id]); return false;\" title=\"Add Song to Current Playlist\"><img src=\"".pic_dir()."add.gif\" /></a> <a class=music href=\"#\" onclick=\"play('song',$row[song_id]); return false;\" title=\"Play this Song Now\"><img src=\"".pic_dir()."play.gif\" /></a> $row[prefix] $row[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/><em>$row[length]</em></p></li>\n"; 592 $count++; 593 } 594 } 595 $output .= "</ul>\n"; 596 return $output; 597 } 598 599 function viewPlaylist(){ 600 mp3act_connect(); 601 $output = ''; 602 $query = "SELECT music_playlist.*, music_artists.artist_name,music_artists.prefix, music_songs.name,music_albums.album_name,music_songs.track,SEC_TO_TIME(music_songs.length) AS time FROM music_playlist,music_artists,music_songs,music_albums WHERE music_playlist.song_id=music_songs.song_id AND music_artists.artist_id=music_songs.artist_id AND music_songs.album_id=music_albums.album_id ORDER BY music_playlist.pl_id"; 603 604 $result=mysql_query($query); 605 606 while($row = mysql_fetch_array($result)){ 607 $output .= "<li id=\"pl$row[pl_id]\" onmouseover=\"setBgcolor('pl".$row['pl_id']."','#FCF7A5'); return false;\" onmouseout=\"setBgcolor('pl".$row['pl_id']."','#f3f3f3'); return false;\"><a class=music href=\"#\" onclick=\"movePLItem('up',this.parentNode); return false;\" title=\"Move Song Up in Playlist\"><img src=\"".pic_dir()."up.gif\" /></a> <a class=music href=\"#\" onclick=\"movePLItem('down',this.parentNode); return false;\" title=\"Move Song Down in Playlist\"><img src=\"".pic_dir()."down.gif\" /></a> <a class=music href=\"#\" onclick=\"plrem(this.parentNode.id); return false;\" title=\"Remove Song from Playlist\"><img src=\"".pic_dir()."rem.gif\" /></a> $row[prefix] $row[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/>$row[time]</p></li>"; 608 } 609 if (isset($output)) { 610 return $output; 611 } else { 612 return ''; 613 } 614 } 615 function savePlaylist($pl_name, $newpl){ 616 617 $songs = array(); 618 $time=0; 619 $query = "SELECT music_playlist.song_id,music_songs.length FROM music_playlist,music_songs WHERE music_songs.song_id=music_playlist.song_id ORDER BY music_playlist.pl_id"; 620 $result = mysql_query($query); 621 while($row = mysql_fetch_array($result)){ 622 $songs[] = $row['song_id']; 623 $time += $row['length']; 624 } 625 $songslist = implode(",",$songs); 626 if ($newpl == 0) 627 { 628 $query = "INSERT INTO music_saved_playlists (playlist_name, playlist_songs, date_created, time, songcount) VALUES (\"$pl_name\",\"$songslist\",NOW(),$time,".count($songs).")"; 629 mysql_query($query); 630 return "<h2 class=\"music\">Playlist Saved as '".$pl_name."'</h2>"; 631 } 632 else 633 { 634 $arr = explode("@",$pl_name); 635 //if ($arr[1] == "") 636 // $query = "UPDATE music_saved_playlists SET playlist_songs = \"$songslist\", date_created = NOW(), time = $time, songcount = ".count($songs)." WHERE playlist_name = \"".$arr[0]."\""; 637 //else 638 $query = "UPDATE music_saved_playlists SET playlist_songs = \"$songslist\", date_created = NOW(), time = $time, songcount = ".count($songs)." WHERE playlist_name = \"".$arr[0]."\" AND hostname = \"".$arr[1]."\""; 639 mysql_query($query); 640 return "<h2 class=\"music\">Playlist '".$pl_name."' has been updated</h2>"; 641 } 642 643 } 644 645 function clearPlaylist(){ 646 mp3act_connect(); 647 $query = "DELETE FROM music_playlist"; 648 /* if($_SESSION['sess_playmode'] == 'streaming'){ 649 $query .= " WHERE user_id=$_SESSION[sess_userid] AND private=1"; 650 } 651 else{ 652 $query .= " WHERE private=0"; 653 }*/ 654 mysql_query($query); 655 return "Playlist is empty"; 656 } 657 function deletePlaylist($id){ 658 mp3act_connect(); 659 $query = "DELETE FROM music_saved_playlists WHERE playlist_id=$id"; 660 mysql_query($query); 661 return 1; 662 } 663 664 function playlistInfo(){ 665 $query = "SELECT COUNT(music_playlist.pl_id) as count, SEC_TO_TIME(SUM(music_songs.length)) as time FROM music_playlist,music_songs WHERE music_playlist.song_id=music_songs.song_id"; 666 $result = mysql_query($query); 667 $row = mysql_fetch_array($result); 668 if($row['count'] == 0){ 669 return "Playlist is empty"; 670 } 671 return "$row[count] Songs - $row[time]"; 672 } 673 674 function playlist_rem($itemid){ 675 $id = substr($itemid, 2); 676 $query = "DELETE FROM music_playlist WHERE pl_id=$id"; 677 mysql_query($query); 678 return $itemid; 679 } 680 681 function playlist_move($item1,$item2){ 682 mp3act_connect(); 683 $item1 = substr($item1, 2); 684 $item2 = substr($item2, 2); 685 $row = array(); 686 $query = "SELECT pl_id,song_id FROM music_playlist WHERE pl_id=$item1 OR pl_id=$item2"; 687 $result = mysql_query($query); 688 while($row[] = mysql_fetch_array($result)){ 689 690 } 691 $query = "UPDATE music_playlist SET song_id=" . $row[0]['song_id'] . " WHERE pl_id=" . $row[1]['pl_id']; 692 mysql_query($query); 693 $query = "UPDATE music_playlist SET song_id=" . $row[1]['song_id'] . " WHERE pl_id=" . $row[0]['pl_id']; 694 695 mysql_query($query); 696 } 697 698 function playlist_add($type,$itemid){ 699 700 switch($type){ 701 case 'song': 702 $query = "INSERT INTO music_playlist (song_id) VALUES (N$itemid)"; 703 mysql_query($query); 704 $id = mysql_insert_id(); 705 $query = "SELECT music_artists.artist_name, music_artists.prefix,music_albums.album_name,SEC_TO_TIME(music_songs.length) AS length,music_songs.name,music_songs.track FROM music_artists,music_songs,music_albums WHERE music_songs.song_id=$itemid AND music_artists.artist_id=music_songs.artist_id AND music_albums.album_id=music_songs.album_id"; 706 $result = mysql_query($query); 707 $row = mysql_fetch_array($result); 708 709 $output[] = "<li id=\"pl$id\" onmouseover=\"setBgcolor('pl".$id."','#FCF7A5'); return false;\" onmouseout=\"setBgcolor('pl".$id."','#f3f3f3'); return false;\"><a class=music href=\"#\" onclick=\"movePLItem('up',this.parentNode); return false;\" title=\"Move Song Up in Playlist\"><img src=\"".pic_dir()."up.gif\" /></a> <a class=music href=\"#\" onclick=\"movePLItem('down',this.parentNode); return false;\" title=\"Move Song Down in Playlist\"><img src=\"".pic_dir()."down.gif\" /></a> <a class=music href=\"#\" onclick=\"plrem(this.parentNode.id); return false;\" title=\"Remove Song from Playlist\"><img src=\"".pic_dir()."rem.gif\" /></a> $row[prefix] $row[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/>$row[length]</p></li>"; 710 $output[] = 1; 711 $output[] = 'pl'.$id; 712 return $output; 713 break; 714 case 'album': 715 $items=''; 716 $output = array(); 717 $query = "SELECT music_songs.song_id,music_songs.name,music_artists.artist_name,music_artists.prefix,music_albums.album_name,SEC_TO_TIME(music_songs.length) AS length,music_songs.name,music_songs.track FROM music_songs,music_artists,music_albums WHERE music_songs.album_id=$itemid AND music_songs.artist_id=music_artists.artist_id AND music_albums.album_id=music_songs.album_id ORDER BY track"; 718 $result = mysql_query($query); 719 while($row = mysql_fetch_array($result)){ 720 $query = "INSERT INTO music_playlist (song_id) VALUES(" . $row['song_id'] . ")"; 721 mysql_query($query); 722 $id = mysql_insert_id(); 723 $output[] = 'pl'.$id; 724 $items .= "<li id=\"pl$id\" onmouseover=\"setBgcolor('pl".$id."','#FCF7A5'); return false;\" onmouseout=\"setBgcolor('pl".$id."','#f3f3f3'); return false;\"><a class=music href=\"#\" onclick=\"movePLItem('up',this.parentNode); return false;\" title=\"Move Song Up in Playlist\"><img src=\"".pic_dir()."up.gif\" /></a> <a class=music href=\"#\" onclick=\"movePLItem('down',this.parentNode); return false;\" title=\"Move Song Down in Playlist\"><img src=\"".pic_dir()."down.gif\" /></a> <a class=music href=\"#\" onclick=\"plrem(this.parentNode.id); return false;\" title=\"Remove Song from Playlist\"><img src=\"".pic_dir()."rem.gif\" /></a> $row[prefix] $row[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/>$row[length]</p></li>"; 725 } 726 $text[] = $items; 727 $num[] = count($output); 728 $text = array_merge($text,$num); 729 $output = array_merge($text,$output); 730 return $output; 731 732 break; 733 case 'playlist': 734 clearPlaylist(); 735 $query = "SELECT * FROM music_saved_playlists WHERE playlist_id=$itemid LIMIT 1"; 736 $result = mysql_query($query); 737 $row = mysql_fetch_array($result); 738 $songs = explode(",",$row['playlist_songs']); 739 740 foreach($songs as $song){ 741 $query = "INSERT INTO music_playlist (song_id) VALUES($song)"; 742 mysql_query($query); 743 } 744 $output[0] = 1; 745 return $output; 746 747 break; 748 } 749 } 750 function randPlay($mode,$type,$num=0,$items){ 751 mp3act_connect(); 752 $tmp = ''; 753 $query = ''; 754 $items2 = explode(" ",$items); 755 $items = ''; 756 757 if($mode == 'streaming'){ 758 759 session_cache_limiter('nocache'); 760 header("Content-Type: audio/mpegurl;"); 761 header("Content-Disposition: inline; filename=\"playlist.m3u\""); 762 header("Expires: 0"); 763 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 764 header("Pragma: nocache"); 765 $tmp .= "#EXTM3U\n"; 766 switch($type){ 767 case 'artists': 768 foreach($items2 as $item){ 769 $items .= " music_songs.artist_id=$item OR"; 770 } 771 $items = preg_replace("/OR$/","",$items); 772 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,music_songs.length FROM music_songs,music_artists WHERE music_artists.artist_id=music_songs.artist_id AND (".$items.") ORDER BY rand()+0 LIMIT $num"; 773 break; 774 case 'genre': 775 foreach($items2 as $item){ 776 $items .= " music_genres.genre_id=$item OR"; 777 } 778 $items = preg_replace("/OR$/","",$items); 779 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,music_songs.length FROM music_songs,music_artists,music_genres,music_albums WHERE music_albums.album_id=music_songs.album_id AND music_albums.album_genre=music_genres.genre AND music_artists.artist_id=music_songs.artist_id AND (".$items.") ORDER BY rand()+0 LIMIT $num"; 780 break; 781 case 'albums': 782 foreach($items2 as $item){ 783 $items .= " music_songs.album_id=$item OR"; 784 } 785 $items = preg_replace("/OR$/","",$items); 786 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,music_songs.length FROM music_songs,music_artists WHERE music_artists.artist_id=music_songs.artist_id AND (".$items.") ORDER BY rand()+0 LIMIT $num"; 787 788 break; 789 case 'all': 790 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,music_songs.length FROM music_songs,music_artists WHERE music_artists.artist_id=music_songs.artist_id ORDER BY rand()+0 LIMIT $num"; 791 break; 792 } 793 $result = mysql_query($query); 794 795 while($row = mysql_fetch_array($result)){ 796 $tmp .= "#EXTINF:$row[length],$row[artist_name] - $row[name]\n"; 797 $tmp .= music_dir()."mp3act_playstream.php?i=$row[song_id]&u=$_SESSION[sess_usermd5]&b=$_SESSION[sess_bitrate]&s=$_SESSION[sess_stereo]\n"; 798 } 799 return $tmp; 800 exit; 801 } 802 } 803 804 function play($mode,$type,$id){ 805 mp3act_connect(); 806 $tmp = ''; 807 $query = ''; 808 809 810 if($mode == 'streaming'){ 811 812 session_cache_limiter('nocache'); 813 header("Content-Type: audio/mpegurl;"); 814 header("Content-Disposition: inline; filename=\"playlist.m3u\""); 815 header("Expires: 0"); 816 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 817 header("Pragma: nocache"); 818 $tmp .= "#EXTM3U\n"; 819 820 if($type=='song'){ 821 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_artists.prefix,music_songs.name,music_songs.length FROM music_songs,music_artists WHERE music_songs.song_id=$id AND music_artists.artist_id=music_songs.artist_id"; 822 } 823 elseif($type=='album'){ 824 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,music_artists.prefix,music_songs.length FROM music_songs,music_artists WHERE music_artists.artist_id=music_songs.artist_id AND music_songs.album_id=$id ORDER BY music_songs.track"; 825 } 826 elseif($type=='pl'){ 827 $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,music_artists.prefix,music_songs.length FROM music_songs,music_artists,music_playlist WHERE music_artists.artist_id=music_songs.artist_id AND music_songs.song_id=music_playlist.song_id ORDER BY music_playlist.pl_id"; 828 } 829 830 $result = mysql_query($query); 831 while($row = mysql_fetch_array($result)){ 832 $length = $row['length']; 833 if($GLOBALS[sample_mode] == 1){ 834 $length = floor($row['length']/4); 835 } 836 $tmp .= "#EXTINF:$length,$row[prefix] $row[artist_name] - $row[name]\n"; 837 $tmp .= music_dir()."mp3act_playstream.php?i=$row[song_id]&u=$_SESSION[sess_usermd5]&b=$_SESSION[sess_bitrate]&s=$_SESSION[sess_stereo]\n"; 838 } 839 return $tmp; 840 exit; 841 } 842 /* // JUKEBOX MODE 843 else{ 844 switch($type){ 845 case 'stop': 846 //exec("killall -c ".basename(getSystemSetting("phpbin"))." > /dev/null 2>&1 &"); 847 //exec("killall -c ".basename(getSystemSetting("mp3bin"))." > /dev/null 2>&1 &"); 848 killCmd("play.php"); 849 killCmd(basename(getSystemSetting("mp3bin"))); 850 //submitScrobbler($_SESSION['sess_userid']); 851 852 if(file_exists("/tmp/mp3act")){ 853 unlink("/tmp/mp3act"); 854 } 855 $query = "UPDATE music_songs SET random=0"; 856 mysql_query($query); 857 $query = "DELETE FROM music_currentsong"; 858 mysql_query($query); 859 break; 860 case 'prev': 861 // PREV is not working... 862 /*exec("killall ".getSystemSetting("phpbin")." > /dev/null 2>&1 &"); 863 exec("killall ".getSystemSetting("mp3bin")." > /dev/null 2>&1 &"); 864 $query = "DELETE FROM music_currentsong"; 865 mysql_query($query); 866 exec(getSystemSetting("phpbin")." includes/play.php 3 $id > /dev/null 2>&1 &"); 867 868 break; 869 case 'next': 870 //exec("killall -c ".basename(getSystemSetting("mp3bin"))." > /dev/null 2>&1 &"); 871 //killCmd(basename(getSystemSetting("mp3bin"))); 872 break; 873 case 'song': 874 /* if(!file_exists("/tmp/mp3act")){ 875 touch("/tmp/mp3act"); 876 exec(getSystemSetting("phpbin")." includes/play.php 1 $_SESSION[sess_userid] $id > /dev/null 2>&1 &"); 877 } 878 break; 879 case 'album': 880 /* if(!file_exists("/tmp/mp3act")){ 881 touch("/tmp/mp3act"); 882 exec(getSystemSetting("phpbin")." includes/play.php 2 $_SESSION[sess_userid] $id > /dev/null 2>&1 &"); 883 } 884 break; 885 case 'pl': 886 /* if(!file_exists("/tmp/mp3act")){ 887 touch("/tmp/mp3act"); 888 exec(getSystemSetting("phpbin")." includes/play.php 3 $id > /dev/null 2>&1 &"); 889 } 890 break; 891 }// END JUKEBOX MODE 892 }*/ 893 } 894 /* 895 function killCmd($cmd){ 896 $pids = shell_exec("ps A | grep '$cmd' | awk -- '{print $1}'"); 897 $pids = explode("\n",$pids); 898 exec("kill $pids[0] $pids[1] > /dev/null 2>&1 &"); 899 } 900 */ 901 /* 902 function playLocal($file){ 903 /* $mp3player = getSystemSetting("mp3bin"); 904 $command = "$mp3player ".escapeshellarg(stripslashes($file)); 905 $pid = shell_exec("nohup $command > /dev/null 2>&1"); 906 //setPid($pid); 907 //$tmp=exec("$mp3player ".escapeshellarg(stripslashes($file))." ");*/ 908 //}*/ 909 /* 910 function setPid($pid){ 911 if(file_exists("/tmp/mp3act") && is_writable("/tmp/mp3act")){ 912 $handle = fopen("/tmp/mp3act", "w"); 913 fwrite($handle, $pid); 914 fclose($handle); 915 } 916 }*/ 917 918 function download($album){ 919 mp3act_connect(); 920 $query = "SELECT music_songs.filename, 921 music_artists.artist_name, 922 music_albums.album_name 923 FROM music_songs,music_artists,music_albums 924 WHERE music_songs.album_id=$album 925 AND music_songs.album_id=music_albums.album_id 926 AND music_songs.artist_id=music_artists.artist_id LIMIT 1"; 927 928 $result = mysql_query($query); 929 $row = mysql_fetch_array($result); 930 $dir = dirname($row['filename']); 931 932 $test = new zip_file("/tmp/album_$album.zip"); 933 $test->set_options(array('inmemory'=>0,'storepaths'=>0,'level'=>0,'method'=>0,'prepend'=>"$row[artist_name] - $row[album_name]")); 934 $test->add_files($dir); 935 936 $test->store_files($dir); 937 $test->create_archive(); 938 939 header("Content-type:application/zip"); 940 941 $header = "Content-disposition: attachment; filename=\""; 942 $header .= "album_$album.zip"; 943 $header .= "\""; 944 header($header); 945 header("Content-length: " . filesize("/tmp/album_$album.zip")); 946 header("Content-transfer-encoding: binary"); 947 header("Pragma: no-cache"); 948 header("Expires: 0"); 949 $chunksize = 1*(1024*1024); // how many bytes per chunk 950 $buffer = ''; 951 $handle = fopen("/tmp/album_$album.zip", 'rb'); 952 if ($handle === false) { 953 return false; 954 } 955 while (!feof($handle)) { 956 $buffer = fread($handle, $chunksize); 957 print $buffer; 958 } 959 fclose($handle); 960 //readfile("/tmp/album_$album.zip"); 961 unlink("/tmp/album_$album.zip"); 962 //$test->download_file(); 963 } 964 965 /*function verifyIP($user_md5,$ip){ 966 mp3act_connect(); 967 $query = "SELECT user_id FROM mp3act_users WHERE md5=\"$user_md5\" AND last_ip=\"$ip\""; 968 $result = mysql_query($query); 969 if(mysql_num_rows($result) > 0){ 970 return true; 971 } 972 return false; 973 }*/ 974 975 976 function updateNumPlays($num,$r=0,$user='',$mode='jukebox'){ 977 mp3act_connect(); 978 $query = "UPDATE music_songs SET numplays=numplays+1"; 979 if($r==1){ 980 $query .= ",random=1"; 981 } 982 $query .= " WHERE song_id=$num"; 983 mysql_query($query); 984 985 if(!empty($user)){ 986 if($mode == 'streaming'){ 987 $query = "SELECT user_id FROM mp3act_users WHERE md5=\"$user\""; 988 $result = mysql_query($query); 989 $row = mysql_fetch_array($result); 990 $user = $row['user_id']; 991 992 } 993 $query = "INSERT INTO music_playhistory VALUES (NULL,$user,$num,NOW())"; 994 // insertScrobbler($num,$user,$mode); 995 mysql_query($query); 996 } 997 } 998 999 function streamPlay($id, $rate=0, $stereo="s",$user='',$ip=''){ 1000 mp3act_connect(); 1001 // check to see if IP is in the verified IP DB for that user 1002 //if(verifyIP($user,$ip)){ 1003 1004 $query = "SELECT music_artists.artist_name, 1005 music_songs.name, 1006 music_songs.bitrate, 1007 music_songs.length as length, 1008 music_songs.filename as filename, 1009 music_songs.size as size 1010 FROM music_songs,music_artists 1011 WHERE music_songs.song_id=$id 1012 AND music_artists.artist_id=music_songs.artist_id"; 1013 1014 $result=mysql_query($query); 1015 $row = mysql_fetch_array($result); 1016 updateNumPlays($id,0,$user,'streaming'); 1017 clearstatcache(); // flush buffer 1018 1019 $file['name'] = basename($row['filename']); 1020 $mp3out = ''; 1021 /*if(getSystemSetting("lamebin") != "" && $rate != 0){ 1022 $row['size'] = (($row['length'] + 1) * $rate * 1000)/8; 1023 $mp3out = getSystemSetting("lamebin")." -b $rate -s $stereo --silent --nores --mp3input -h \"".stripslashes($row['filename'])."\" -"; 1024 }else{*/ 1025 $mp3out = stripslashes($row['filename']); 1026 1027 //} 1028 $size=$row['size']; 1029 $mode = $GLOBALS[sample_mode]; 1030 //$mode = getSystemSetting("sample_mode"); 1031 if($mode == 1){ 1032 $size = floor($row['size']/4); 1033 } 1034 header("Content-Type: audio/mpeg"); 1035 header("Content-Length: $size"); 1036 header("Content-Disposition: filename=$row[artist_name] - $row[name]"); 1037 1038 // Run the command, and read back the results at the bitrate size + 1K. 1039 $blocksize=($row['bitrate']*1024)+1024; 1040 $totaldata=0; 1041 if($rate!=0 && $mode==1){ 1042 $temp = @popen($mp3out, "r"); 1043 while (($data = @fread($temp, $blocksize )) && ($totaldata <= $size ) ) 1044 {echo $data; $totaldata+=$blocksize; } 1045 pclose($temp); 1046 } 1047 elseif($rate!=0 ){ 1048 $temp = @popen($mp3out, "r"); 1049 while ($data = @fread($temp, $blocksize) ) 1050 {echo $data; } 1051 pclose($temp); 1052 } 1053 elseif($mode==1 ){ 1054 $temp = @fopen($mp3out, "r"); 1055 while (!feof($temp) && ($totaldata <= $size ) ) 1056 {$data = @fread($temp, $blocksize); echo $data; $totaldata+=$blocksize; } 1057 fclose($temp); 1058 } 1059 else{ 1060 $temp = @fopen($mp3out, "r"); 1061 while (!feof($temp) ) 1062 {$data = @fread($temp, $blocksize); echo $data; } 1063 fclose($temp); 1064 } 1065 //} // end IF for verify IP 1066 exit; 1067 } 1068 1069 function art_insert($album_id, $artist, $album){ 1070 mp3act_connect(); 1071 $query =''; 1072 $image = art_query($artist,$album); 1073 if($image != ""){ 1074 $query = "UPDATE music_albums SET album_art=\"$album_id.jpg\" WHERE album_id=$album_id"; 1075 mysql_query($query); 1076 1077 $tmpimg = http_get($image); 1078 $path = $GLOBALS['abs_path']."/art/"; 1079 1080 $file = "$album_id.jpg"; 1081 $filename = $path.$file; 1082 touch($filename); 1083 1084 // Let's make sure the art directory is writable first. 1085 if (is_writable($filename)) { 1086 1087 if (!$handle = fopen($filename, 'a')) { 1088 echo "Cannot open file ($filename)"; 1089 exit; 1090 } 1091 1092 // Write $somecontent to our opened file. 1093 if (fwrite($handle, $tmpimg) === FALSE) { 1094 echo "Cannot write to file ($filename)"; 1095 exit; 1096 } 1097 1098 fclose($handle); 1099 1100 } else { 1101 echo "The file $filename is not writable"; 1102 } 1103 1104 return $file; 1105 } 1106 else{ 1107 $query = "UPDATE music_albums SET album_art=\"fail\" WHERE album_id=$album_id"; 1108 mysql_query($query); 1109 } 1110 1111 } 1112 1113 function art_query ($artist, $album) { 1114 /* $amazon_api_id = getSystemSetting("amazonid"); 1115 if(!empty($amazon_api_id)){ 1116 $album = preg_replace( '!\(.+\)!', '', $album ); 1117 $theq = "$artist, $album"; 1118 $query = urlencode($theq); 1119 1120 $file = "http://xml.amazon.com/onca/xml3?t=blah&dev-t="; 1121 $file .= $amazon_api_id; 1122 $file .= "&mode=music&type=lite&page=1&f=xml&KeywordSearch="; 1123 $file .= $query; 1124 $fp = fopen($file, "r"); 1125 $contentStart = fread($fp, 200000); 1126 1127 $content = ereg_replace("<?xml.*\">.*<ProductInfo.*\">","",$contentStart); 1128 1129 $items = explode("</Details>",$content); 1130 $maxlinks2 = "1"; 1131 1132 for ($i = 0; $i < $maxlinks2; $i++) { 1133 1134 //$artSmall = ereg_replace(".*<ImageUrlSmall>","",$items[$i]); 1135 //$artSmall = ereg_replace("</ImageUrlSmall>.*","",$artSmall); 1136 $artMedium = ereg_replace(".*<ImageUrlMedium>","",$items[$i]); 1137 $artMedium = ereg_replace("</ImageUrlMedium>.*","",$artMedium); 1138 //$artLarge = ereg_replace(".*<ImageUrlLarge>","",$items[$i]); 1139 //$artLarge = ereg_replace("</ImageUrlLarge>.*","",$artLarge); 1140 1141 if (strstr($artMedium, "amazon.com") == true) { 1142 1143 //$small_size = getimagesize($artSmall); 1144 //if($small_size[0] > 2) { $small_okay = "yes"; } else { $small_okay = "no"; } 1145 /* $medium_size = getimagesize($artMedium); 1146 if($medium_size[0] > 2) { $medium_okay = "yes"; } else { $medium_okay = "no"; } 1147 $large_size = getimagesize($artLarge); 1148 if($large_size[0] > 2) { $large_okay = "yes"; } else { $large_okay = "no"; } 1149 1150 //return $artSmall; 1151 return $artMedium; 1152 1153 } else { 1154 return ''; 1155 } 1156 1157 } 1158 } 1159 else{ 1160 return ''; 1161 }*/ 1162 1163 } 1164 1165 // Grab an image over the web and save it locally 1166 function http_get($url) 1167 { 1168 1169 $url_stuff = parse_url($url); 1170 $port = isset($url_stuff['port']) ? $url_stuff['port'] : 80; 1171 1172 $fp = fsockopen($url_stuff['host'], $port); 1173 $buffer = ''; 1174 $query = 'GET ' . $url_stuff['path'] . " HTTP/1.0\n"; 1175 $query .= 'Host: ' . $url_stuff['host']; 1176 $query .= "\n\n"; 1177 1178 fwrite($fp, $query); 1179 1180 while ($tmp = fread($fp, 1024)) 1181 { 1182 $buffer .= $tmp; 1183 } 1184 1185 preg_match('/Content-Length: ([0-9]+)/', $buffer, $parts); 1186 return substr($buffer, - $parts[1]); 1187 1188 1189 } 1190 ?> 1191 No newline at end of file -
mythweb/modules/music/mp3act_hidden.php
Property changes on: mythweb/modules/music/mp3act_functions.php ___________________________________________________________________ Name: svn:executable + *
1 <?php 2 // hidden iframe to process streaming 3 include("mp3act_functions.php"); 4 5 // Play the Music 6 if(isset($_GET['type'])){ 7 if($_GET['type'] == 'artists' || $_GET['type'] == 'genre' || $_GET['type'] == 'albums' || $_GET['type'] == 'all'){ 8 // echo "rand"; 9 echo randPlay('streaming',$_GET['type'],$_GET['num'],$_GET['items']); 10 } 11 else{ 12 // echo "play"; 13 echo play('streaming',$_GET['type'],$_GET['id']); 14 // play($_SESSION['sess_playmode'],$_GET['type'],$_GET['id']); 15 } 16 } 17 ?> -
mythweb/modules/music/init.php
Property changes on: mythweb/modules/music/mp3act_hidden.php ___________________________________________________________________ Name: svn:executable + *
16 16 // First, we should check to see that MythMusic is configured. 17 17 // Make sure to turn off fatal errors in case the table isn't there. 18 18 $db->disable_fatal_errors(); 19 $has_music = $db->query_col('SELECT COUNT(*) FROM music metadata');19 $has_music = $db->query_col('SELECT COUNT(*) FROM music_songs'); 20 20 $db->enable_fatal_errors(); 21 21 $db->error(false); 22 22 -
mythweb/modules/music/mp3act_fat.js
1 var Fat = { 2 make_hex : function (r,g,b) 3 { 4 r = r.toString(16); if (r.length == 1) r = '0' + r; 5 g = g.toString(16); if (g.length == 1) g = '0' + g; 6 b = b.toString(16); if (b.length == 1) b = '0' + b; 7 return "#" + r + g + b; 8 }, 9 fade_all : function () 10 { 11 var a = document.getElementsByTagName("*"); 12 for (var i = 0; i < a.length; i++) 13 { 14 var o = a[i]; 15 var r = /fade-?(\w{3,6})?/.exec(o.className); 16 if (r) 17 { 18 if (!r[1]) r[1] = ""; 19 if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]); 20 } 21 } 22 }, 23 fade_element : function (id, fps, duration, from, to) 24 { 25 if (!fps) fps = 30; 26 if (!duration) duration = 3000; 27 if (!from || from=="#") from = "#FFFF33"; 28 if (!to) to = this.get_bgcolor(id); 29 30 var frames = Math.round(fps * (duration / 1000)); 31 var interval = duration / frames; 32 var delay = interval; 33 var frame = 0; 34 35 if (from.length < 7) from += from.substr(1,3); 36 if (to.length < 7) to += to.substr(1,3); 37 38 var rf = parseInt(from.substr(1,2),16); 39 var gf = parseInt(from.substr(3,2),16); 40 var bf = parseInt(from.substr(5,2),16); 41 var rt = parseInt(to.substr(1,2),16); 42 var gt = parseInt(to.substr(3,2),16); 43 var bt = parseInt(to.substr(5,2),16); 44 45 var r,g,b,h; 46 while (frame < frames) 47 { 48 r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames)); 49 g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames)); 50 b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames)); 51 h = this.make_hex(r,g,b); 52 53 setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay); 54 55 frame++; 56 delay = interval * frame; 57 } 58 setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay); 59 }, 60 set_bgcolor : function (id, c) 61 { 62 var o = document.getElementById(id); 63 o.style.backgroundColor = c; 64 }, 65 get_bgcolor : function (id) 66 { 67 var o = document.getElementById(id); 68 while(o) 69 { 70 var c; 71 if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color"); 72 if (o.currentStyle) c = o.currentStyle.backgroundColor; 73 if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; } 74 o = o.parentNode; 75 } 76 if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF"; 77 var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/); 78 if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3])); 79 return c; 80 } 81 } 82 No newline at end of file -
mythweb/modules/music/mp3act_playstream.php
Property changes on: mythweb/modules/music/mp3act_fat.js ___________________________________________________________________ Name: svn:executable + *
1 <?php 2 include_once("modules/music/mp3act_functions.php"); 3 set_time_limit(0); 4 streamPlay($_GET['i'],$_GET['b'],$_GET['s'],$_GET['u'],$_SERVER['REMOTE_ADDR']) 5 ?> 6 No newline at end of file -
mythmusic/mythmusic/metadata.cpp
Property changes on: mythweb/modules/music/mp3act_playstream.php ___________________________________________________________________ Name: svn:executable + *
44 44 rating = rhs->Rating(); 45 45 lastplay = rhs->LastPlayStr(); 46 46 playcount = rhs->Playcount(); 47 bitrate = rhs->Bitrate(); 48 filesize = rhs->Filesize(); 47 49 compilation = rhs->Compilation(); 48 50 id = rhs->ID(); 49 51 filename = rhs->Filename(); … … 62 64 void Metadata::persist() 63 65 { 64 66 MSqlQuery query(MSqlQuery::InitCon()); 65 query.prepare("UPDATE music metadataset rating = :RATING , "66 " playcount= :PLAYCOUNT , lastplay = :LASTPLAY "67 "where intid = :ID ;");67 query.prepare("UPDATE music_songs set rating = :RATING , " 68 "numplays = :PLAYCOUNT , lastplay = :LASTPLAY " 69 "where song_id = :ID ;"); 68 70 query.bindValue(":RATING", rating); 69 71 query.bindValue(":PLAYCOUNT", playcount); 70 72 query.bindValue(":LASTPLAY", lastplay); … … 98 100 QString sqlfilename = filename.remove(0, m_startdir.length()); 99 101 100 102 MSqlQuery query(MSqlQuery::InitCon()); 101 query.prepare("SELECT artist,compilation_artist,album,title,genre,year,tracknum," 102 "length,intid,rating,playcount,lastplay,compilation,format FROM " 103 "musicmetadata WHERE filename = :FILENAME ;"); 103 query.prepare("SELECT music_artists.artist_name, music_artists_1.artist_name AS compilation_artist, " 104 "music_albums.album_name, music_songs.name, music_genres.genre, music_songs.year, " 105 "music_songs.track, music_songs.length, music_songs.song_id, music_songs.rating, " 106 "music_songs.numplays, music_songs.lastplay, music_songs.compilation, " 107 "music_songs.format FROM (((music_songs INNER JOIN music_artists ON " 108 "music_songs.artist_id = music_artists.artist_id) INNER JOIN music_albums ON " 109 "music_songs.album_id = music_albums.album_id) INNER JOIN music_genres ON " 110 "music_songs.genre_id = music_genres.genre_id) INNER JOIN music_artists AS " 111 "music_artists_1 ON music_albums.artist_id = music_artists_1.artist_id WHERE " 112 "(((music_songs.filename)= :FILENAME ));"); 104 113 query.bindValue(":FILENAME", sqlfilename.utf8()); 105 114 106 115 if (query.exec() && query.isActive() && query.size() > 0) … … 146 155 // Don't update the database if a song with the exact same 147 156 // metadata is already there 148 157 MSqlQuery query(MSqlQuery::InitCon()); 149 query.prepare("SELECT filename FROM musicmetadata WHERE " 150 "( ( artist = :ARTIST ) AND " 151 "( compilation_artist = :COMPILATION_ARTIST ) " 152 "( album = :ALBUM ) AND ( title = :TITLE ) " 153 "AND ( genre = :GENRE ) AND " 154 "( year = :YEAR ) AND ( tracknum = :TRACKNUM ) " 155 "AND ( length = :LENGTH ) " 156 "AND ( format = :FORMAT) );"); 158 query.prepare("SELECT music_songs.filename FROM (((music_songs " 159 "INNER JOIN music_artists ON music_songs.artist_id = " 160 "music_artists.artist_id) INNER JOIN music_albums ON " 161 "music_songs.album_id = music_albums.album_id) INNER " 162 "JOIN music_artists AS music_artists_1 ON music_albums.compilationartist_id " 163 "= music_artists_1.artist_id) INNER JOIN music_genres ON " 164 "music_songs.genre_id = music_genres.genre_id WHERE " 165 "(((music_artists.artist_name)=:ARTIST) AND " 166 "((music_artists_1.artist_id)=:COMPILATION_ARTIST) " 167 "AND ((music_albums.album_name)=:ALBUM) AND " 168 "((music_songs.name)=:TITLE) AND " 169 "((music_genres.genre)=:GENRE) AND ((music_songs.year)=:YEAR) " 170 "AND ((music_songs.track)=:TRACKNUM) AND " 171 "((music_songs.length)=:LENGTH) AND " 172 "((music_songs.format)=:FORMAT));"); 173 157 174 query.bindValue(":ARTIST", artist.utf8()); 158 175 query.bindValue(":COMPILATION_ARTIST", compilation_artist.utf8()); 159 176 query.bindValue(":ALBUM", album.utf8()); … … 167 184 if (query.exec() && query.isActive() && query.size() > 0) 168 185 return; 169 186 170 query.prepare("INSERT INTO musicmetadata " 171 "(artist, compilation_artist, album, title, " 172 " genre, year, tracknum, length, " 173 " filename, compilation, date_added, date_modified, " 174 " format ) " 187 //Genrecheck 188 //Albumcheck 189 //Artist 190 int ArtistID; 191 query.prepare("SELECT music_artists.artist_id FROM music_artists " 192 " WHERE (((music_artists.artist_name)=:ARTIST));"); 193 query.bindValue(":ARTIST", artist.utf8()); 194 query.exec(); 195 // cout << query.executedQuery() << endl; 196 if (query.size() > 0) 197 { 198 query.next(); 199 ArtistID = query.value(0).toInt(); 200 } 201 else 202 { 203 query.prepare("INSERT INTO music_artists (artist_name) VALUES (:ARTIST);"); 204 query.bindValue(":ARTIST", artist.utf8()); 205 query.exec(); 206 // cout << query.executedQuery() << endl; 207 query.prepare("SELECT music_artists.artist_id FROM music_artists " 208 " WHERE (((music_artists.artist_name)=:ARTIST));"); 209 query.bindValue(":ARTIST", artist.utf8()); 210 query.exec(); 211 // cout << query.executedQuery() << endl; 212 query.next(); 213 ArtistID = query.value(0).toInt(); 214 } 215 216 //Compilation Artist 217 int CoArtistID; 218 query.prepare("SELECT music_artists.artist_id FROM music_artists " 219 " WHERE (((music_artists.artist_name)=:ARTIST));"); 220 query.bindValue(":ARTIST", compilation_artist.utf8()); 221 query.exec(); 222 // cout << query.executedQuery() << endl; 223 if (query.size() > 0) 224 { 225 query.next(); 226 CoArtistID = query.value(0).toInt(); 227 } 228 else 229 { 230 query.prepare("INSERT INTO music_artists (artist_name) VALUES (:ARTIST);"); 231 query.bindValue(":ARTIST", compilation_artist.utf8()); 232 query.exec(); 233 // cout << query.executedQuery() << endl; 234 query.prepare("SELECT music_artists.artist_id FROM music_artists " 235 " WHERE (((music_artists.artist_name)=:ARTIST));"); 236 query.bindValue(":ARTIST", compilation_artist.utf8()); 237 query.exec(); 238 // cout << query.executedQuery() << endl; 239 query.next(); 240 CoArtistID = query.value(0).toInt(); 241 } 242 243 //Album 244 int AlbumID; 245 query.prepare("SELECT music_albums.album_id FROM music_albums " 246 " WHERE (((music_albums.album_name)=:ALBUM));"); 247 query.bindValue(":ALBUM", album.utf8()); 248 query.exec(); 249 // cout << query.executedQuery() << endl; 250 if (query.size() > 0) 251 { 252 query.next(); 253 AlbumID = query.value(0).toInt(); 254 } 255 else 256 { 257 query.prepare("INSERT INTO music_albums (album_name) VALUES (:ALBUM);"); 258 query.bindValue(":ALBUM", album.utf8()); 259 query.exec(); 260 // cout << query.executedQuery() << endl; 261 262 query.prepare("SELECT music_albums.album_id FROM music_albums " 263 " WHERE (((music_albums.album_name)=:ALBUM));"); 264 query.bindValue(":ALBUM", album.utf8()); 265 query.exec(); 266 // cout << query.executedQuery() << endl; 267 query.next(); 268 269 AlbumID = query.value(0).toInt(); 270 } 271 272 //Genres 273 int GenreID; 274 query.prepare("SELECT music_genres.genre_id FROM music_genres " 275 " WHERE (((music_genres.genre)=:GENRE));"); 276 query.bindValue(":GENRE", genre.utf8()); 277 query.exec(); 278 // cout << query.executedQuery() << endl; 279 if (query.size() > 0) 280 { 281 query.next(); 282 GenreID = query.value(0).toInt(); 283 } 284 else 285 { 286 query.prepare("INSERT INTO music_genres (genre) VALUES (:GENRE);"); 287 query.bindValue(":GENRE", genre.utf8()); 288 query.exec(); 289 // cout << query.executedQuery() << endl; 290 291 query.prepare("SELECT music_genres.genre_id FROM music_genres " 292 " WHERE (((music_genres.genre)=:GENRE));"); 293 query.bindValue(":GENRE", genre.utf8()); 294 query.exec(); 295 // cout << query.executedQuery() << endl; 296 query.next(); 297 GenreID = query.value(0).toInt(); 298 } 299 300 //Song hinzufgen 301 302 query.prepare("INSERT INTO music_songs " 303 "(artist_id, album_id, compilationartist_id, name, " 304 " genre_id, year, track, length, " 305 " filename, compilation, date_entered, date_modified, " 306 " format, size, bitrate ) " 175 307 "VALUES " 176 "(:ARTIST, : COMPILATION_ARTIST,:ALBUM,:TITLE, "308 "(:ARTIST, :ALBUM, :COMPILATION_ARTIST, :TITLE, " 177 309 " :GENRE, :YEAR, :TRACKNUM, :LENGTH, " 178 310 " :FILENAME,:COMPILATION, :DATE_ADDED,:DATE_MOD," 179 " :FORMAT )");180 query.bindValue(":ARTIST", artist.utf8());181 query.bindValue(":COMPILATION_ARTIST", compilation_artist.utf8());182 query.bindValue(":ALBUM", album.utf8());311 " :FORMAT, :FILESIZE, :BITRATE)"); 312 query.bindValue(":ARTIST", ArtistID); 313 query.bindValue(":COMPILATION_ARTIST", CoArtistID); 314 query.bindValue(":ALBUM", AlbumID); 183 315 query.bindValue(":TITLE", title.utf8()); 184 query.bindValue(":GENRE", genre.utf8());316 query.bindValue(":GENRE", GenreID); 185 317 query.bindValue(":YEAR", year); 186 318 query.bindValue(":TRACKNUM", tracknum); 187 319 query.bindValue(":LENGTH", length); … … 190 322 query.bindValue(":DATE_ADDED", QDateTime::currentDateTime()); 191 323 query.bindValue(":DATE_MOD", QDateTime::currentDateTime()); 192 324 query.bindValue(":FORMAT", format); 325 query.bindValue(":FILESIZE", filesize); 326 query.bindValue(":BITRATE", bitrate); 193 327 328 194 329 query.exec(); 195 330 // cout << query.executedQuery() << endl; 196 331 // easiest way to ensure we've got 'id' filled. 197 332 fillData(); 198 333 } … … 341 476 342 477 MSqlQuery query(MSqlQuery::InitCon()); 343 478 344 query.prepare("UPDATE music metadata"479 query.prepare("UPDATE music_songs " 345 480 "SET artist = :ARTIST, " 346 481 " album = :ALBUM, " 347 482 " title = :TITLE, " … … 353 488 " compilation = :COMPILATION, " 354 489 " compilation_artist = :COMPILATION_ARTIST, " 355 490 " format = :FORMAT " 356 "WHERE intid = :ID;");491 "WHERE song_id = :ID;"); 357 492 query.bindValue(":ARTIST", artist.utf8()); 358 493 query.bindValue(":ALBUM", album.utf8()); 359 494 query.bindValue(":TITLE", title.utf8()); … … 427 562 if (title == "") 428 563 return; 429 564 430 QString thequery = "SELECT artist,compilation_artist,album,title,genre,year,tracknum,length," 431 "filename,intid,rating,playcount,lastplay,compilation,format " 432 "FROM musicmetadata WHERE title = :TITLE"; 565 // QString thequery = "SELECT artist,compilation_artist,album,title,genre,year,tracknum,length," 566 // "filename,song_id,rating,playcount,lastplay,compilation,format " 567 // "FROM musicmetadata WHERE title = :TITLE"; 568 QString thequery = "SELECT music_artists.artist_name, music_artists_1.artist_name AS compilation_artist, " 569 "music_albums.album_name, music_songs.name, music_genres.genre, music_songs.year, " 570 "music_songs.track, music_songs.length, music_songs.filename, music_songs.song_id, " 571 "music_songs.rating, music_songs.numplays, music_songs.lastplay, music_songs.compilation, " 572 "music_songs.format FROM music_artists AS music_artists_1 INNER JOIN (((music_songs INNER " 573 "JOIN music_artists ON music_songs.artist_id = music_artists.artist_id) INNER JOIN " 574 "music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN " 575 "music_genres ON music_songs.genre_id = music_genres.genre_id) ON " 576 "music_artists_1.artist_id = music_songs.compilationartist_id WHERE name = :TITLE"; 433 577 434 578 if (album != "") 435 thequery += " AND album = :ALBUM";579 thequery += " AND album_name = :ALBUM"; 436 580 if (artist != "") 437 thequery += " AND artist = :ARTIST";581 thequery += " AND artist_name = :ARTIST"; 438 582 if (compilation_artist != "") 439 583 thequery += " AND compilation_artist = :COMPILATION_ARTIST"; 440 584 … … 478 622 return; 479 623 480 624 MSqlQuery query(MSqlQuery::InitCon()); 481 query.prepare("SELECT title,artist,compilation_artist,album,title,genre,year,tracknum," 482 "length,filename,rating,playcount,lastplay,compilation,format FROM " 483 "musicmetadata WHERE intid = :ID ;"); 625 // query.prepare("SELECT title,artist,compilation_artist,album,title,genre,year,tracknum," 626 // "length,filename,rating,playcount,lastplay,compilation,format FROM " 627 // "musicmetadata WHERE song_id = :ID ;"); 628 query.prepare("SELECT music_songs.name, music_artists.artist_name, music_artists_1.artist_name AS " 629 "compilation_artist, music_albums.album_name, music_genres.genre, music_songs.year, " 630 "music_songs.track, music_songs.length, music_songs.filename, music_songs.rating, " 631 "music_songs.numplays, music_songs.lastplay, music_songs.compilation, music_songs.format " 632 "FROM music_artists AS music_artists_1 INNER JOIN (((music_songs INNER JOIN music_artists " 633 "ON music_songs.artist_id = music_artists.artist_id) INNER JOIN music_albums ON " 634 "music_songs.album_id = music_albums.album_id) INNER JOIN music_genres ON " 635 "music_songs.genre_id = music_genres.genre_id) ON music_artists_1.artist_id = " 636 "music_songs.compilationartist_id WHERE (((music_songs.song_id) = :ID ));"); 484 637 query.bindValue(":ID", id); 485 638 486 639 if (query.exec() && query.isActive() && query.numRowsAffected() > 0) … … 491 644 artist = QString::fromUtf8(query.value(1).toString()); 492 645 compilation_artist = QString::fromUtf8(query.value(2).toString()); 493 646 album = QString::fromUtf8(query.value(3).toString()); 494 title = QString::fromUtf8(query.value(4).toString()); 495 genre = QString::fromUtf8(query.value(5).toString()); 496 year = query.value(6).toInt(); 497 tracknum = query.value(7).toInt(); 498 length = query.value(8).toInt(); 499 filename = QString::fromUtf8(query.value(9).toString()); 500 rating = query.value(10).toInt(); 501 playcount = query.value(11).toInt(); 502 lastplay = query.value(12).toString(); 503 compilation = (query.value(13).toInt() > 0); 504 format = query.value(14).toString(); 647 genre = QString::fromUtf8(query.value(4).toString()); 648 year = query.value(5).toInt(); 649 tracknum = query.value(6).toInt(); 650 length = query.value(7).toInt(); 651 filename = QString::fromUtf8(query.value(8).toString()); 652 rating = query.value(9).toInt(); 653 playcount = query.value(10).toInt(); 654 lastplay = query.value(11).toString(); 655 compilation = (query.value(12).toInt() > 0); 656 format = query.value(13).toString(); 505 657 506 658 if (!filename.contains("://")) 507 659 filename = m_startdir + filename; … … 644 796 void AllMusic::resync() 645 797 { 646 798 done_loading = false; 647 QString aquery = "SELECT intid, artist, compilation_artist, album, title, genre, "648 "year, tracknum, length, filename, rating, "649 "lastplay, playcount, compilation, format "650 "FROM musicmetadata"651 "ORDER BY intid;";799 // QString aquery = "SELECT song_id, artist, compilation_artist, album, title, genre, " 800 // "year, tracknum, length, filename, rating, " 801 // "lastplay, playcount, compilation, format " 802 // "FROM music_songs " 803 // "ORDER BY song_id;"; 652 804 805 QString aquery = "SELECT music_songs.song_id, music_artists.artist_name, " 806 "music_artists_1.artist_name AS compilation_artist, music_albums.album_name, " 807 "music_songs.name, music_genres.genre, music_songs.year, music_songs.track, " 808 "music_songs.length, music_songs.filename, music_songs.rating, " 809 "music_songs.lastplay, music_songs.numplays, music_songs.compilation, " 810 "music_songs.format, music_songs.bitrate, music_songs.size FROM music_artists AS music_artists_1 INNER JOIN " 811 "(((music_songs INNER JOIN music_artists ON music_songs.artist_id = " 812 "music_artists.artist_id) INNER JOIN music_genres ON music_songs.genre_id = " 813 "music_genres.genre_id) INNER JOIN music_albums ON music_songs.album_id = " 814 "music_albums.album_id) ON music_artists_1.artist_id = " 815 "music_songs.compilationartist_id ORDER BY music_songs.song_id;"; 816 817 653 818 QString filename, artist, album, title; 654 819 655 820 MSqlQuery query(MSqlQuery::InitCon()); … … 694 859 query.value(0).toInt(), 695 860 query.value(10).toInt(), 696 861 query.value(12).toInt(), 862 query.value(15).toInt(), //bitrate 863 query.value(16).toInt(), //filesize 697 864 query.value(11).toString(), 698 865 (query.value(13).toInt() > 0), 699 866 query.value(14).toString()); -
mythmusic/mythmusic/dbcheck.cpp
9 9 #include "mythtv/mythcontext.h" 10 10 #include "mythtv/mythdbcon.h" 11 11 12 const QString currentDatabaseVersion = "100 5";12 const QString currentDatabaseVersion = "1006"; 13 13 14 14 static void UpdateDBVersionNumber(const QString &newnumber) 15 15 { … … 323 323 324 324 performActualUpdate(updates, "1005", dbver); 325 325 } 326 327 328 if (dbver == "1005") 329 { 330 const QString updates[] = { 331 "DROP TABLE musicmetadata;", 332 "DROP TABLE musicplaylist;", 333 "CREATE TABLE music_albums (album_id int(11) NOT NULL auto_increment, album_name varchar(255) NOT NULL default '', album_art text NOT NULL, PRIMARY KEY (album_id));", 334 "CREATE TABLE music_artists (artist_id int(11) NOT NULL auto_increment, artist_name varchar(255) default NULL, prefix varchar(7) NOT NULL default '', PRIMARY KEY (artist_id));", 335 "CREATE TABLE music_currentsong (song_id int(11) NOT NULL default '0', pl_id int(11) NOT NULL default '0', random tinyint(3) NOT NULL default '0');", 336 "CREATE TABLE music_genres (genre_id int(11) NOT NULL auto_increment, genre varchar(25) NOT NULL default '', PRIMARY KEY (genre_id));", 337 "CREATE TABLE music_playhistory (play_id int(11) NOT NULL auto_increment, user_id int(6) default NULL, song_id int(11) default NULL, date_played datetime default NULL, PRIMARY KEY (play_id));", 338 "CREATE TABLE music_playlist (pl_id int(11) NOT NULL auto_increment, song_id int(11) default NULL, user_id int(11) NOT NULL default '0', PRIMARY KEY (pl_id));", 339 "CREATE TABLE music_saved_playlists (playlist_id int(11) NOT NULL auto_increment, playlist_name varchar(255) default NULL, playlist_songs text, date_created datetime default NULL, time int(11) default NULL, songcount smallint(8) default NULL, hostname VARCHAR(255), PRIMARY KEY (playlist_id));", 340 "CREATE TABLE music_songs (song_id int(11) NOT NULL auto_increment, artist_id int(11) NOT NULL default '0', compilationartist_id int(11) NOT NULL default '0', album_id int(11) NOT NULL default '0', genre_id int(11) NOT NULL default '0', year smallint(6) NOT NULL default '0', lastplay datetime default NULL, date_entered datetime default NULL, date_modified datetime default NULL, name varchar(255) default NULL, track smallint(6) NOT NULL default '0', length int(11) NOT NULL default '0', size int(11) NOT NULL default '0', bitrate int(11) NOT NULL default '0', type varchar(4) default NULL, numplays int(11) NOT NULL default '0', rating tinyint(4) NOT NULL default '0', filename text, random tinyint(4) NOT NULL default '0', format varchar(4) NOT NULL default '0', compilation tinyint default 0, PRIMARY KEY (song_id));", 341 "CREATE TABLE music_stats (num_artists smallint(5) unsigned NOT NULL default '0', num_albums smallint(5) unsigned NOT NULL default '0', num_songs mediumint(8) unsigned NOT NULL default '0', num_genres tinyint(3) unsigned NOT NULL default '0', total_time varchar(12) NOT NULL default '0', total_size varchar(10) NOT NULL default '0');", 342 "RENAME TABLE smartplaylist TO music_smartplaylist;", 343 "RENAME TABLE smartplaylistitem TO music_smartplaylistitem;", 344 "RENAME TABLE smartplaylistcategory TO music_smartplaylistcategory;", 345 "" 346 }; 347 performActualUpdate(updates, "1006", dbver); 348 } 326 349 } 327 350 -
mythmusic/mythmusic/metaioid3v2.h
23 23 24 24 private: 25 25 int getTrackLength(QString filename); 26 int getTrackBitRate(QString filename); 26 27 27 28 QString getRawID3String(union id3_field *pField); 28 29 void removeComment(id3_tag *pTag, const char* pLabel, const QString desc = ""); -
mythmusic/mythmusic/playlist.cpp
326 326 all_other_playlists->clear(); 327 327 328 328 MSqlQuery query(MSqlQuery::InitCon()); 329 query.prepare("SELECT playlistid FROM musicplaylist " 330 "WHERE name != :DEFAULT " 331 "AND name != :BACKUP " 332 "AND hostname = :HOST ORDER BY playlistid ;"); 329 // query.prepare("SELECT playlistid FROM musicplaylist " 330 // "WHERE name != :DEFAULT " 331 // "AND name != :BACKUP " 332 // "AND hostname = :HOST ORDER BY playlistid ;"); 333 // query.bindValue(":DEFAULT", "default_playlist_storage"); 334 // query.bindValue(":BACKUP", "backup_playlist_storage"); 335 // query.bindValue(":HOST", my_host); 336 query.prepare("SELECT playlist_id FROM music_saved_playlists WHERE playlist_name != :DEFAULT AND playlist_name != :BACKUP ORDER BY playlist_id;"); 333 337 query.bindValue(":DEFAULT", "default_playlist_storage"); 334 338 query.bindValue(":BACKUP", "backup_playlist_storage"); 335 query.bindValue(":HOST", my_host);336 339 337 340 if (query.exec() && query.isActive() && query.size() > 0) 338 341 { … … 468 471 } 469 472 470 473 MSqlQuery query(MSqlQuery::InitCon()); 471 query.prepare("SELECT playlistid, name, songlist FROM "472 "musicplaylist WHERE name = :NAME AND "473 "hostname = :HOST ;");474 query.bindValue(":NAME", a_name);475 query.bindValue(":HOST", a_host);476 474 475 if (name == "default_playlist_storage" || name == "backup_playlist_storage") 476 { 477 query.prepare("SELECT playlist_id, playlist_name, playlist_songs FROM " 478 "music_saved_playlists WHERE playlist_name = :NAME AND hostname = :HOST;"); 479 query.bindValue(":NAME", a_name); 480 query.bindValue(":HOST", a_host); 481 } 482 else 483 { 484 query.prepare("SELECT playlist_id, playlist_name, playlist_songs FROM " 485 "music_saved_playlists WHERE playlist_name = :NAME;"); 486 query.bindValue(":NAME", a_name); 487 } 488 477 489 if (query.exec() && query.size() > 0) 478 490 { 479 491 while (query.next()) … … 498 510 void Playlist::loadPlaylistByID(int id, QString a_host) 499 511 { 500 512 MSqlQuery query(MSqlQuery::InitCon()); 501 query.prepare("SELECT playlistid, name, songlist FROM " 502 "musicplaylist WHERE playlistid = :ID AND " 503 "hostname = :HOST ;"); 513 query.prepare("SELECT playlist_id, playlist_name, playlist_songs FROM " 514 "music_saved_playlists WHERE playlist_id = :ID;"); 504 515 query.bindValue(":ID", id); 505 query.bindValue(":HOST", a_host);516 // query.bindValue(":HOST", a_host); 506 517 507 518 query.exec(); 508 519 … … 603 614 604 615 QString theQuery; 605 616 606 theQuery = "SELECT intid FROM musicmetadata";617 theQuery = "SELECT song_id FROM music_songs "; 607 618 608 619 if (whereClause.length() > 0) 609 620 theQuery += whereClause; … … 717 728 QString orderBy; 718 729 int limitTo; 719 730 720 query.prepare("SELECT smartplaylistid, matchtype, orderby, limitto "731 query.prepare("SELECT music_smartplaylistid, matchtype, orderby, limitto " 721 732 "FROM smartplaylist WHERE categoryid = :CATEGORYID AND name = :NAME;"); 722 733 query.bindValue(":NAME", name.utf8()); 723 734 query.bindValue(":CATEGORYID", categoryID); … … 748 759 QString whereClause = "WHERE "; 749 760 750 761 query.prepare("SELECT field, operator, value1, value2 " 751 "FROM smartplaylistitem WHERE smartplaylistid = :ID;");762 "FROM music_smartplaylistitem WHERE smartplaylistid = :ID;"); 752 763 query.bindValue(":ID", ID); 753 764 query.exec(); 754 765 if (query.isActive() && query.numRowsAffected() > 0) … … 787 798 return; 788 799 789 800 fillSonglistFromSongs(); 801 MSqlQuery query(MSqlQuery::InitCon()); 790 802 791 MSqlQuery query(MSqlQuery::InitCon()); 792 query.prepare("SELECT NULL FROM musicplaylist WHERE playlistid = :ID ;"); 803 int songcount = 0, playtime = 0, an_int; 804 QStringList list = QStringList::split(",", raw_songlist); 805 QStringList::iterator it = list.begin(); 806 for (; it != list.end(); it++) 807 { 808 an_int = QString(*it).toInt(); 809 if (an_int != 0) 810 { 811 songcount++; 812 query.prepare("SELECT length FROM music_songs WHERE song_id = :ID ;"); 813 query.bindValue(":ID", playlistid); 814 query.exec(); 815 query.next(); 816 playtime += query.value(0).toInt(); 817 } 818 } 819 820 query.prepare("SELECT NULL FROM music_saved_playlists WHERE playlist_id = :ID ;"); 793 821 query.bindValue(":ID", playlistid); 794 822 795 823 if (query.exec() && query.isActive() && query.size() > 0) 796 824 { 797 query.prepare("UPDATE music playlist SET songlist= :LIST , "798 " name = :NAME WHERE playlistid = :ID ;");825 query.prepare("UPDATE music_saved_playlists SET playlist_songs = :LIST , " 826 "playlist_name = :NAME, songcount = :SONGCOUNT, time = :PLAYTIME WHERE playlist_id = :ID ;"); 799 827 query.bindValue(":LIST", raw_songlist); 800 828 query.bindValue(":NAME", a_name.utf8()); 829 query.bindValue(":SONGCOUNT", songcount); 830 query.bindValue(":PLAYTIME", playtime); 801 831 query.bindValue(":ID", playlistid); 802 832 } 803 833 else 804 834 { 805 query.prepare("INSERT INTO music playlist (name,songlist) "806 "VALUES(:NAME, :LIST );");835 query.prepare("INSERT INTO music_saved_playlists (playlist_name,playlist_songs, songcount, time) " 836 "VALUES(:NAME, :LIST, :SONGCOUNT, :PLAYTIME);"); 807 837 query.bindValue(":LIST", raw_songlist); 808 838 query.bindValue(":NAME", a_name.utf8()); 839 query.bindValue(":SONGCOUNT", songcount); 840 query.bindValue(":PLAYTIME", playtime); 809 841 } 810 842 811 843 query.exec(); … … 827 859 } 828 860 829 861 fillSonglistFromSongs(); 862 MSqlQuery query(MSqlQuery::InitCon()); 863 864 int songcount = 0, playtime = 0, an_int; 865 QStringList list = QStringList::split(",", raw_songlist); 866 QStringList::iterator it = list.begin(); 867 for (; it != list.end(); it++) 868 { 869 an_int = QString(*it).toInt(); 870 if (an_int != 0) 871 { 872 songcount++; 873 query.prepare("SELECT length FROM music_songs WHERE song_id = :ID ;"); 874 query.bindValue(":ID", playlistid); 875 query.exec(); 876 query.next(); 877 playtime += query.value(0).toInt(); 878 } 879 } 830 880 831 MSqlQuery query(MSqlQuery::InitCon()); 832 query.prepare("INSERT musicplaylist (name, hostname) " 833 "VALUES(:NAME, :HOST);"); 881 query.prepare("INSERT music_saved_playlists (playlist_name, hostname, songcount, time) " 882 "VALUES(:NAME, :HOST, :SONGCOUNT, :PLAYTIME);"); 834 883 query.bindValue(":NAME", name.utf8()); 835 884 query.bindValue(":HOST", a_host); 885 query.bindValue(":SONGCOUNT", songcount); 886 query.bindValue(":PLAYTIME", playtime); 836 887 837 888 query.exec(); 838 889 839 query.prepare("SELECT playlist id FROM musicplaylistWHERE "840 " name = :NAME AND hostname = :HOST;");890 query.prepare("SELECT playlist_id FROM music_saved_playlists WHERE " 891 "playlist_name = :NAME AND hostname = :HOST;"); 841 892 query.bindValue(":NAME", name.utf8()); 842 893 query.bindValue(":HOST", a_host); 843 894 … … 1210 1261 } 1211 1262 1212 1263 MSqlQuery query(MSqlQuery::InitCon()); 1213 query.prepare("DELETE FROM music playlist WHERE playlistid = :ID ;");1264 query.prepare("DELETE FROM music_saved_playlists WHERE playlist_id = :ID ;"); 1214 1265 query.bindValue(":ID", kill_me); 1215 1266 1216 1267 if (query.exec() || query.size() < 1) -
mythmusic/mythmusic/smartplaylist.cpp
33 33 static SmartPLField SmartPLFields[] = 34 34 { 35 35 { "", "", ftString, 0, 0, 0 }, 36 { "Artist", " artist", ftString, 0, 0, 0 },37 { "Album", "album ", ftString, 0, 0, 0 },38 { "Title", " title", ftString, 0, 0, 0 },36 { "Artist", "music_artists.artist_name", ftString, 0, 0, 0 }, 37 { "Album", "album_name", ftString, 0, 0, 0 }, 38 { "Title", "name", ftString, 0, 0, 0 }, 39 39 { "Genre", "genre", ftString, 0, 0, 0 }, 40 40 { "Year", "year", ftNumeric, 1900, 2099, 2000 }, 41 { "Track No.", "track num", ftNumeric, 0, 99, 0 },41 { "Track No.", "track", ftNumeric, 0, 99, 0 }, 42 42 { "Rating", "rating", ftNumeric, 0, 10, 0 }, 43 { "Play Count", " playcount", ftNumeric, 0, 9999, 0 },43 { "Play Count", "numplays", ftNumeric, 0, 9999, 0 }, 44 44 { "Compilation", "compilation", ftBoolean, 0, 0, 0 }, 45 { "Comp. Artist", " compilation_artist", ftString, 0, 0, 0 },45 { "Comp. Artist", "music_artists_1.artist_name", ftString, 0, 0, 0 }, 46 46 { "Last Play", "FROM_DAYS(TO_DAYS(lastplay))", ftDate, 0, 0, 0 }, 47 47 { "Date Imported", "FROM_DAYS(TO_DAYS(date_added))", ftDate, 0, 0, 0 }, 48 48 }; … … 656 656 657 657 MSqlQuery query(MSqlQuery::InitCon()); 658 658 QString querystr; 659 querystr = QString("SELECT DISTINCT %1 FROM musicmetadataORDER BY %2").arg(field).arg(field);659 querystr = QString("SELECT DISTINCT %1 FROM FROM music_artists AS music_artists_1 INNER JOIN (((music_songs INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id) INNER JOIN music_genres ON music_songs.genre_id = music_genres.genre_id) ON music_artists_1.artist_id = music_songs.compilationartist_id ORDER BY %2").arg(field).arg(field); 660 660 661 661 query.exec(querystr); 662 662 if (query.isActive() && query.numRowsAffected()) … … 815 815 } 816 816 817 817 MSqlQuery query(MSqlQuery::InitCon()); 818 query.prepare("INSERT INTO smartplaylistitem (smartplaylistid, field, operator,"818 query.prepare("INSERT INTO music_smartplaylistitem (smartplaylistid, field, operator," 819 819 " value1, value2)" 820 820 "VALUES (:SMARTPLAYLISTID, :FIELD, :OPERATOR, :VALUE1, :VALUE2);"); 821 821 query.bindValue(":SMARTPLAYLISTID", smartPlaylistID); … … 1130 1130 { 1131 1131 bPlaylistIsValid = true; 1132 1132 1133 QString sql = "select count(*) from music metadata";1133 QString sql = "select count(*) from music_songs "; 1134 1134 sql += getWhereClause(); 1135 1135 1136 1136 MSqlQuery query(MSqlQuery::InitCon()); … … 1177 1177 1178 1178 MSqlQuery query(MSqlQuery::InitCon()); 1179 1179 // insert new smartplaylist 1180 query.prepare("INSERT INTO smartplaylist (name, categoryid, matchtype, orderby, limitto) "1180 query.prepare("INSERT INTO music_smartplaylist (name, categoryid, matchtype, orderby, limitto) " 1181 1181 "VALUES (:NAME, :CATEGORYID, :MATCHTYPE, :ORDERBY, :LIMIT);"); 1182 1182 query.bindValue(":NAME", name.utf8()); 1183 1183 query.bindValue(":CATEGORYID", categoryid); … … 1193 1193 1194 1194 // get smartplaylistid 1195 1195 int ID; 1196 query.prepare("SELECT smartplaylistid FROM smartplaylist "1196 query.prepare("SELECT smartplaylistid FROM music_smartplaylist " 1197 1197 "WHERE categoryid = :CATEGORYID AND name = :NAME;"); 1198 1198 query.bindValue(":CATEGORYID", categoryid); 1199 1199 query.bindValue(":NAME", name.utf8()); … … 1253 1253 int ID; 1254 1254 1255 1255 query.prepare("SELECT smartplaylistid, name, categoryid, matchtype, orderby, limitto " 1256 "FROM smartplaylist WHERE name = :NAME AND categoryid = :CATEGORYID;");1256 "FROM music_smartplaylist WHERE name = :NAME AND categoryid = :CATEGORYID;"); 1257 1257 query.bindValue(":NAME", name.utf8()); 1258 1258 query.bindValue(":CATEGORYID", categoryid); 1259 1259 if (query.exec()) … … 1285 1285 uint rowCount; 1286 1286 1287 1287 query.prepare("SELECT field, operator, value1, value2 " 1288 "FROM smartplaylistitem WHERE smartplaylistid = :ID "1288 "FROM music_smartplaylistitem WHERE smartplaylistid = :ID " 1289 1289 "ORDER BY smartplaylistitemid;"); 1290 1290 query.bindValue(":ID", ID); 1291 1291 if (!query.exec()) … … 1392 1392 // insert new smartplaylistcategory 1393 1393 1394 1394 MSqlQuery query(MSqlQuery::InitCon()); 1395 query.prepare("INSERT INTO smartplaylistcategory (name) "1395 query.prepare("INSERT INTO music_smartplaylistcategory (name) " 1396 1396 "VALUES (:NAME);"); 1397 1397 query.bindValue(":NAME", categoryEdit->text().utf8()); 1398 1398 … … 1438 1438 1439 1439 // change the category 1440 1440 MSqlQuery query(MSqlQuery::InitCon()); 1441 query.prepare("UPDATE smartplaylistcategory SET name = :NEW_CATEGORY "1441 query.prepare("UPDATE music_smartplaylistcategory SET name = :NEW_CATEGORY " 1442 1442 "WHERE name = :OLD_CATEGORY;"); 1443 1443 query.bindValue(":OLD_CATEGORY", categoryCombo->currentText().utf8()); 1444 1444 query.bindValue(":NEW_CATEGORY", categoryEdit->text().utf8()); … … 1459 1459 { 1460 1460 QString sql, whereClause, orderByClause, limitClause; 1461 1461 1462 sql = "SELECT " + fields + " FROM music metadata";1462 sql = "SELECT " + fields + " FROM music_artists AS music_artists_1 INNER JOIN (((music_songs INNER JOIN music_albums ON music_songs.album_id = music_albums.album_id) INNER JOIN music_artists ON music_songs.artist_id = music_artists.artist_id) INNER JOIN music_genres ON music_songs.genre_id = music_genres.genre_id) ON music_artists_1.artist_id = music_songs.compilationartist_id "; 1463 1463 whereClause = getWhereClause(); 1464 1464 orderByClause = getOrderByClause(); 1465 1465 if (limitSpinEdit->value() > 0) … … 1506 1506 1507 1507 void SmartPlaylistEditor::showResultsClicked(void) 1508 1508 { 1509 QString sql = getSQL(" intid, artist, album, title, genre, year, tracknum");1509 QString sql = getSQL("song_id, artist_name, album_name, name, genre, year, track"); 1510 1510 1511 1511 SmartPLResultViewer *resultViewer = new SmartPLResultViewer(gContext->GetMainWindow(), "resultviewer"); 1512 1512 resultViewer->setSQL(sql); … … 1535 1535 categoryCombo->clear(); 1536 1536 MSqlQuery query(MSqlQuery::InitCon()); 1537 1537 1538 if (query.exec("SELECT name FROM smartplaylistcategory ORDER BY name;"))1538 if (query.exec("SELECT name FROM music_smartplaylistcategory ORDER BY name;")) 1539 1539 { 1540 1540 if (query.isActive() && query.numRowsAffected() > 0) 1541 1541 { … … 1563 1563 1564 1564 // get playlist ID 1565 1565 int ID; 1566 query.prepare("SELECT smartplaylistid FROM smartplaylist WHERE name = :NAME "1566 query.prepare("SELECT smartplaylistid FROM music_smartplaylist WHERE name = :NAME " 1567 1567 "AND categoryid = :CATEGORYID;"); 1568 1568 query.bindValue(":NAME", name.utf8()); 1569 1569 query.bindValue(":CATEGORYID", categoryid); … … 1588 1588 } 1589 1589 1590 1590 //delete smartplaylist items 1591 query.prepare("DELETE FROM smartplaylistitem WHERE smartplaylistid = :ID;");1591 query.prepare("DELETE FROM music_smartplaylistitem WHERE smartplaylistid = :ID;"); 1592 1592 query.bindValue(":ID", ID); 1593 1593 if (!query.exec()) 1594 1594 MythContext::DBError("Delete smartplaylist items", query); 1595 1595 1596 1596 //delete smartplaylist 1597 query.prepare("DELETE FROM smartplaylist WHERE smartplaylistid = :ID;");1597 query.prepare("DELETE FROM music_smartplaylist WHERE smartplaylistid = :ID;"); 1598 1598 query.bindValue(":ID", ID); 1599 1599 if (!query.exec()) 1600 1600 MythContext::DBError("Delete smartplaylist", query); … … 1610 1610 MSqlQuery query(MSqlQuery::InitCon()); 1611 1611 1612 1612 //delete all smartplaylists with the selected category 1613 query.prepare("SELECT name FROM smartplaylist "1613 query.prepare("SELECT name FROM music_smartplaylist " 1614 1614 "WHERE categoryid = :CATEGORYID;"); 1615 1615 query.bindValue(":CATEGORYID", categoryid); 1616 1616 if (!query.exec()) … … 1629 1629 } 1630 1630 1631 1631 // delete the category 1632 query.prepare("DELETE FROM smartplaylistcategory WHERE categoryid = :ID;");1632 query.prepare("DELETE FROM music_smartplaylistcategory WHERE categoryid = :ID;"); 1633 1633 query.bindValue(":ID", categoryid); 1634 1634 if (!query.exec()) 1635 1635 MythContext::DBError("Delete smartplaylist category", query); … … 1642 1642 { 1643 1643 int ID; 1644 1644 MSqlQuery query(MSqlQuery::InitCon()); 1645 query.prepare("SELECT categoryid FROM smartplaylistcategory "1645 query.prepare("SELECT categoryid FROM music_smartplaylistcategory " 1646 1646 "WHERE name = :CATEGORY;"); 1647 1647 query.bindValue(":CATEGORY", category.utf8()); 1648 1648 … … 2023 2023 categoryCombo->clear(); 2024 2024 MSqlQuery query(MSqlQuery::InitCon()); 2025 2025 2026 if (query.exec("SELECT name FROM smartplaylistcategory ORDER BY name;"))2026 if (query.exec("SELECT name FROM music_smartplaylistcategory ORDER BY name;")) 2027 2027 { 2028 2028 if (query.isActive() && query.numRowsAffected() > 0) 2029 2029 { … … 2045 2045 listbox->clear(); 2046 2046 2047 2047 MSqlQuery query(MSqlQuery::InitCon()); 2048 query.prepare("SELECT name FROM smartplaylist WHERE categoryid = :CATEGORYID "2048 query.prepare("SELECT name FROM music_smartplaylist WHERE categoryid = :CATEGORYID " 2049 2049 "ORDER BY name;"); 2050 2050 query.bindValue(":CATEGORYID", categoryid); 2051 2051 -
mythmusic/mythmusic/metadata.h
18 18 Metadata(QString lfilename = "", QString lartist = "", QString lcompilation_artist = "", 19 19 QString lalbum = "", QString ltitle = "", QString lgenre = "", 20 20 int lyear = 0, int ltracknum = 0, int llength = 0, int lid = 0, 21 int lrating = 0, int lplaycount = 0, QString llastplay = "",21 int lrating = 0, int lplaycount = 0, int lbitrate = 0, int lfilesize = 0, QString llastplay = "", 22 22 bool lcompilation = false, QString lformat="") 23 23 { 24 24 filename = lfilename; … … 35 35 id = lid; 36 36 rating = lrating; 37 37 playcount = lplaycount; 38 bitrate = lbitrate; 39 filesize = lfilesize; 38 40 lastplay = llastplay; 39 41 compilation = lcompilation; 40 42 changed = false; … … 59 61 rating = other.rating; 60 62 lastplay = other.lastplay; 61 63 playcount = other.playcount; 64 bitrate = other.bitrate; 65 filesize = other.filesize; 62 66 compilation = other.compilation; 63 67 show = other.show; 64 68 changed = false; … … 97 101 int Playcount() { return playcount; } 98 102 void setPlaycount(int lplaycount) { playcount = lplaycount; } 99 103 104 int Bitrate() { return bitrate; } 105 void setBitrate(int lbitrate) { bitrate = lbitrate; } 106 107 int Filesize() { return filesize; } 108 void setFilesize(int lfilesize) { filesize = lfilesize; } 109 100 110 unsigned int ID() { return id; } 101 111 void setID(int lid) { id = lid; } 102 112 … … 158 168 int rating; 159 169 QString lastplay; 160 170 int playcount; 171 int bitrate; 172 int filesize; 161 173 bool compilation; 162 174 163 175 unsigned int id; -
mythmusic/mythmusic/main.cpp
76 76 { 77 77 Metadata *data = decoder->getMetadata(); 78 78 if (data) { 79 QFileInfo fi1( filename ); 80 data->setFilesize( fi1.size() ); 79 81 data->dumpToDatabase(); 80 82 delete data; 81 83 } … … 90 92 QString name(filename); 91 93 name.remove(0, directory.length()); 92 94 MSqlQuery query(MSqlQuery::InitCon()); 93 query.prepare("DELETE FROM music metadataWHERE "95 query.prepare("DELETE FROM music_songs WHERE " 94 96 "filename = :NAME ;"); 95 97 query.bindValue(":NAME", filename.utf8()); 96 98 query.exec(); … … 260 262 261 263 MSqlQuery query(MSqlQuery::InitCon()); 262 264 query.exec("SELECT filename, date_modified " 263 "FROM music metadata"265 "FROM music_songs " 264 266 "WHERE filename NOT LIKE ('%://%')"); 265 267 266 268 int counter = 0; … … 558 560 559 561 560 562 MSqlQuery count_query(MSqlQuery::InitCon()); 561 count_query.exec("SELECT COUNT(*) FROM music metadata;");563 count_query.exec("SELECT COUNT(*) FROM music_songs;"); 562 564 563 565 bool musicdata_exists = false; 564 566 if (count_query.isActive()) -
mythmusic/mythmusic/metaioid3v2.cpp
174 174 { 175 175 QString artist = "", compilation_artist = "", album = "", title = "", 176 176 genre = ""; 177 int year = 0, tracknum = 0, length = 0 ;177 int year = 0, tracknum = 0, length = 0, bitrate = 0; 178 178 bool compilation = false; 179 179 id3_file *p_input = NULL; 180 180 … … 251 251 } 252 252 253 253 length = getTrackLength(filename); 254 bitrate = getTrackBitRate(filename); 254 255 255 256 // If we don't have title and artist or don't have the length return NULL 256 257 if ((title.isEmpty() && artist.isEmpty()) || length<=0) … … 261 262 } 262 263 263 264 Metadata *retdata = new Metadata(filename, artist, compilation_artist, album, 264 title, genre, year, tracknum, length); 265 title, genre, year, tracknum, length, 0, 0, 266 0, bitrate); 265 267 266 268 retdata->setCompilation(compilation); 267 269 … … 378 380 return alt_length; 379 381 } 380 382 383 //========================================================================== 384 /*! 385 * \brief Find the bitrate of the track (in bytes/sek) 386 * 387 * \param filename The filename for which we want to find the length. 388 * \returns An integer to represent the bitrate. 389 */ 390 int MetaIOID3v2::getTrackBitRate(QString filename) 391 { 392 struct mad_stream stream; 393 struct mad_header header; 394 mad_timer_t timer; 381 395 396 unsigned char buffer[8192]; 397 unsigned int buflen = 0; 398 399 mad_stream_init(&stream); 400 mad_header_init(&header); 401 402 timer = mad_timer_zero; 403 404 FILE *input = fopen(filename.local8Bit(), "r"); 405 if (!input) 406 input = fopen(filename.ascii(), "r"); 407 408 if (!input) 409 return 0; 410 411 struct stat s; 412 fstat(fileno(input), &s); 413 unsigned long old_bitrate = 0; 414 bool vbr = false; 415 int amount_checked = 0; 416 bool loop_de_doo = true; 417 418 while (loop_de_doo) 419 { 420 if (buflen < sizeof(buffer)) 421 { 422 int bytes; 423 bytes = fread(buffer + buflen, 1, sizeof(buffer) - buflen, input); 424 if (bytes <= 0) 425 break; 426 buflen += bytes; 427 } 428 429 mad_stream_buffer(&stream, buffer, buflen); 430 431 while (1) 432 { 433 if (mad_header_decode(&header, &stream) == -1) 434 { 435 if (!MAD_RECOVERABLE(stream.error)) 436 { 437 break; 438 } 439 if (stream.error == MAD_ERROR_LOSTSYNC) 440 { 441 int tagsize = id3_tag_query(stream.this_frame, 442 stream.bufend - 443 stream.this_frame); 444 if (tagsize > 0) 445 { 446 mad_stream_skip(&stream, tagsize); 447 s.st_size -= tagsize; 448 } 449 } 450 } 451 else 452 { 453 if(amount_checked == 0) 454 { 455 old_bitrate = header.bitrate; 456 } 457 else if(header.bitrate != old_bitrate) 458 { 459 vbr = true; 460 } 461 if(amount_checked == 32 && !vbr) 462 { 463 loop_de_doo = false; 464 break; 465 } 466 amount_checked++; 467 mad_timer_add(&timer, header.duration); 468 } 469 470 } 471 472 if (stream.error != MAD_ERROR_BUFLEN) 473 break; 474 475 memmove(buffer, stream.next_frame, &buffer[buflen] - stream.next_frame); 476 buflen -= stream.next_frame - &buffer[0]; 477 } 478 479 mad_header_finish(&header); 480 mad_stream_finish(&stream); 481 482 fclose(input); 483 484 // if (vbr) 485 // return mad_timer_count(timer, MAD_UNITS_MILLISECONDS); 486 487 return old_bitrate; 488 } 489 382 490 inline QString MetaIOID3v2::getRawID3String(union id3_field *pField) 383 491 { 384 492 QString tmp = "";