Ticket #1699: changes.3.4.patch

File changes.3.4.patch, 161.4 KB (added by jochen, 18 years ago)

Version 3.4

  • mythweb/skins/default/music.css

     
     1mp3act {
     2        padding: 22px;
     3        margin:0;
     4        color: #333;
     5        text-align: center;
     6        font: 65% Verdana, Sans-serif;
     7}
     8
     9h2.music{
     10        font-size: 100%;
     11        margin:0;
     12        padding: 0 0 5px 0;
     13
     14}
     15ul.music{
     16        list-style-type: none;
     17}
     18a.music{
     19        color: blue;
     20}
     21
     22a.music:hover{
     23        /*color: #fff;
     24        background: #F21518;
     25        text-decoration: none;*/
     26        color: #F21518;
     27}
     28img{
     29        border: 0;
     30}
     31input,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}
     41input.check{
     42  border:0;
     43  padding:0;
     44  background: transparent;
     45}
     46select{
     47        padding: 2px 0 2px 3px;
     48}
     49input:focus{
     50        border: 1px solid #999;
     51        background: #FBF9D3;
     52        color: #000;
     53        border-color: #777 #bbb #bbb #777;
     54}
     55
     56input.btn,input.redbtn{
     57        background: #244A79;
     58        color: #fff;
     59        padding: 2px;
     60        border-color: #0E2F58;
     61        font: normal 10px sans-serif;
     62}
     63input.redbtn{
     64        background: #F21518;   
     65}
     66input.redbtn:hover{
     67        background: #BE0D0F;
     68}
     69input.btn:hover{
     70        background: #0E2F58;
     71}
     72
     73input.btn2{
     74        font-weight: bold;
     75        padding: 2px;
     76}
     77
     78input.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}
     100p#error{
     101        color: #f20000;
     102        font-weight: bold;
     103}
     104#breadcrumb{
     105        height: 14px;
     106        padding:2px 0 0 0;
     107}
     108#breadcrumb span{
     109position: 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{
     137width: 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}
     177p.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}
     225ul#nav{
     226        position: absolute;
     227        bottom:0;
     228        list-style-type: none;
     229        margin:0;
     230        padding:0;
     231}
     232ul#nav li{
     233        float: left;
     234        margin-right: 5px;
     235}
     236ul#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}
     244ul#nav li a:hover{
     245        background: #416899;
     246        color: #fff;
     247}
     248ul#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
    
     
     1mp3act {
     2        padding: 22px;
     3        margin:0;
     4        color: #333;
     5        text-align: center;
     6        font: 65% Verdana, Sans-serif;
     7}
     8
     9h2.music{
     10        font-size: 100%;
     11        margin:0;
     12        padding: 0 0 5px 0;
     13
     14}
     15ul.music{
     16        list-style-type: none;
     17}
     18a.music{
     19        color: blue;
     20}
     21
     22a.music:hover{
     23        /*color: #fff;
     24        background: #F21518;
     25        text-decoration: none;*/
     26        color: #F21518;
     27}
     28img{
     29        border: 0;
     30}
     31input,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}
     41input.check{
     42  border:0;
     43  padding:0;
     44  background: transparent;
     45}
     46select{
     47        padding: 2px 0 2px 3px;
     48}
     49input:focus{
     50        border: 1px solid #999;
     51        background: #FBF9D3;
     52        color: #000;
     53        border-color: #777 #bbb #bbb #777;
     54}
     55
     56input.btn,input.redbtn{
     57        background: #244A79;
     58        color: #fff;
     59        padding: 2px;
     60        border-color: #0E2F58;
     61        font: normal 10px sans-serif;
     62}
     63input.redbtn{
     64        background: #F21518;   
     65}
     66input.redbtn:hover{
     67        background: #BE0D0F;
     68}
     69input.btn:hover{
     70        background: #0E2F58;
     71}
     72
     73input.btn2{
     74        font-weight: bold;
     75        padding: 2px;
     76}
     77
     78input.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}
     100p#error{
     101        color: #f20000;
     102        font-weight: bold;
     103}
     104#breadcrumb{
     105        height: 14px;
     106        padding:2px 0 0 0;
     107}
     108#breadcrumb span{
     109position: 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{
     137width: 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}
     177p.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}
     225ul#nav{
     226        position: absolute;
     227        bottom:0;
     228        list-style-type: none;
     229        margin:0;
     230        padding:0;
     231}
     232ul#nav li{
     233        float: left;
     234        margin-right: 5px;
     235}
     236ul#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}
     244ul#nav li a:hover{
     245        background: #416899;
     246        color: #fff;
     247}
     248ul#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
     14include_once("modules/music/mp3act_functions.php");
     15require_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";
     19sajax_init();
     20sajax_export("getplaylistnames","musicLookup","playlist_rem","playlist_add","playlistInfo","clearPlaylist","buildBreadcrumb","play","playlist_move","searchMusic","viewPlaylist","getDropDown","savePlaylist","getRandItems","randAdd","deletePlaylist");
     21sajax_handle_client_request();
     22
     23require 'modules/_shared/tmpl/'.tmpl.'/header.php';
     24?>
     25<link rel="Stylesheet" href="<?php echo skin_url ?>music.css" type="text/css" />
     26
     27        <script type="text/javascript">
     28                        var page = 'search';
     29                        var mode = '<?php echo $_SESSION['sess_playmode']; ?>';
     30                        var bc_parenttype = '';
     31                        var bc_parentitem = '';
     32                        var bc_childtype = '';
     33                        var bc_childitem = '';
     34                        var prevpage = '';
     35                        var currentpage = 'search';
     36                        var nowplaying = 0;
     37                        var isplaying = 0;
     38                        var clearbc = 1;
     39                       
     40        <?php sajax_show_javascript(); ?></script>
     41        <script type="text/javascript" src="<?php echo root; ?>music/mp3act_js.js.php"></script>       
     42        <script type="text/javascript" src="<?php echo root; ?>music/mp3act_fat.js"></script>
     43
     44<div id="wrap">
     45        <div id="header">
     46                <div id="controls">
     47                       
     48                </div>
     49                <h1 id="pagetitle"></h1>
     50                <ul class="music" id="nav">
     51                        <li><a href="#" id="search_music" onclick="switchPage('search'); return false;" title="Search the Music Database"><?php echo t("Search"); ?></a></li>
     52                        <li><a href="#" id="browse" onclick="switchPage('browse'); return false;"  title="Browse the Music Database" class="c"><?php echo t("Browse"); ?></a></li>
     53                        <li><a href="#" id="random" onclick="switchPage('random'); return false;" title="Create Random Mixes"><?php echo t("Random"); ?></a></li>
     54                        <li><a href="#" id="playlists" onclick="switchPage('playlists'); return false;" title="Load Saved Playlists"><?php echo t("Playlists"); ?></a></li>
     55                        <li><a href="#" id="stats" onclick="switchPage('stats'); return false;" title="View Server Statistics"><?php echo t("Stats"); ?></a></li>
     56                </ul>
     57               
     58        </div>
     59        <div id="loading"><h1><?php echo t("LOADING"); ?>...</h1></div>
     60        <div id="left">
     61                <h2 id="breadcrumb"></h2>               
     62                <div class="box" id="info">
     63                </div>
     64        </div>
     65       
     66        <div id="right">
     67                        <div class="box">
     68                                <div class="head">
     69                                        <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>
     70                                        <h2 id="pl_title"></h2><span id="pl_info"></span>
     71                                </div>
     72                        <ul class="music" id="playlist">
     73                                       
     74                        </ul>
     75                       
     76                        <div id="box_extra"> </div>
     77                        </div>
     78        </div>
     79        <div class="clear"></div>
     80</div>
     81<iframe src="<?php echo root; ?>music/mp3act_hidden.php" frameborder="0" height="0" width="0" id="hidden" name="hidden"></iframe>
     82<?
     83require 'modules/_shared/tmpl/'.tmpl.'/footer.php';
     84?>
     85 No newline at end of file
  • mythweb/modules/music/handler.php

    Property changes on: mythweb/modules/music/mp3act_main.php
    ___________________________________________________________________
    Name: svn:executable
       + *
    
     
    1313 *
    1414/**/
    1515
    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             $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="&amp;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="&amp;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 . "&amp;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 . "&amp;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 . "&amp;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 
     16    if (tmpl == "compact")
     17        {
     18        require_once("modules/music/music_handler.php");
     19        }
     20    else
     21        {
     22        if (in_array($Path[1], array('mp3act_js.js.php', 'mp3act_fat.js', 'mp3act_hidden.php')))
     23            {
     24            require_once 'modules/music/'.$Path[1];
     25            exit();
     26                }
     27        if (strstr($Path[1],"mp3act_playstream.php") != false)
     28            {
     29            require_once 'modules/music/mp3act_playstream.php';
     30            exit();
     31            }
     32   
     33        require_once 'modules/music/mp3act_main.php';
     34        }
     35?>   
     36 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//
     57require_once tmpl_dir.'music.php';
     58
     59$mythmusic = new mythMusic();
     60$mythmusic->display();
     61
     62class 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="&amp;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="&amp;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 . "&amp;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 . "&amp;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 . "&amp;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   
     2if (!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
     2function music_dir()
     3    {
     4    return 'http://'.$_SERVER['HTTP_HOST'].root."music/";
     5}
     6?>
     7        window.onload=function(){ init(); };
     8       
     9        function init(){
     10                setPageTitle();
     11                x_viewPlaylist(viewPlaylist_cb);
     12                x_playlistInfo(plinfo_cb);
     13                setPLTitle();
     14                setCurrentPage();
     15                updateBox(page,0);
     16        }
     17        function empty_cb(new_data){
     18         
     19        }
     20       
     21        function setPageNav(){
     22                //document.getElementById("breadcrumb").innerHTML = prevpage;
     23        }
     24   
     25        function switchPage(newpage){
     26                prevpage = page;
     27                page = newpage;
     28       
     29                updateBox(page,0);
     30                setPageTitle();
     31                setCurrentPage();
     32                //setPageNav();
     33        }
     34       
     35        function setPLTitle(){
     36                document.getElementById("pl_title").innerHTML = " <? echo t("Playlist"); ?> ";
     37        }
     38       
     39        function viewPlaylist_cb(new_data){
     40                document.getElementById("playlist").innerHTML = new_data;
     41        }
     42       
     43        function setCurrentPage(){
     44                var x = document.getElementById('nav');
     45                var y = x.getElementsByTagName('a');
     46                for (var i=0;i<y.length;i++){
     47                                        y[i].removeAttribute("class");
     48                                        if(y[i].id == page)
     49                                                y[i].setAttribute('class','c');
     50                                }
     51        }
     52       
     53        function getDropDown(type,id){
     54                x_getDropDown(type,id,getDropDown_cb);
     55        }
     56       
     57        function getDropDown_cb(new_data){
     58                ul = document.getElementById("browse_ul");
     59                ul.innerHTML = new_data;
     60                ul.style.display = 'block';
     61        }
     62       
     63        function closeDropDown(){
     64                ul = document.getElementById("browse_ul");
     65                ul.style.display = 'none';
     66                ul.innerHTML = '';
     67        }
     68       
     69        function savePL_cb(data){
     70                        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>";
     71                        save_form = save_form + "<form onsubmit='return savePL(\"saveold\",this)' method='get' action=''><hr><strong>overwrite Playlist:&nbsp;</strong></ br><select name='overwrite_pl_name'>";
     72                        save_form = save_form + data;
     73                        save_form = save_form + "&nbsp;</select>&nbsp;<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> ";                           
     74                        document.getElementById("box_extra").innerHTML = save_form;
     75                        document.getElementById("box_extra").style.display = 'block';
     76                }
     77       
     78        function savePL(type,data){
     79                if(type=='open'){
     80                        x_getplaylistnames(savePL_cb);
     81                }
     82                else if(type=='save'){
     83                        var pl_name = data.save_pl_name.value;
     84                        x_savePlaylist(pl_name,0,save_Playlist_cb);                         
     85
     86                        return false;
     87                }
     88                else if(type=='saveold'){
     89                        var ov_pl_name = data.overwrite_pl_name.value;
     90                        x_savePlaylist(ov_pl_name,1,save_Playlist_cb);
     91
     92                        return false;
     93                }
     94                else if(type=='close')
     95                        document.getElementById("box_extra").style.display = 'none';
     96        }
     97       
     98        function save_Playlist_cb(new_data){
     99                box = document.getElementById("box_extra");
     100                box.innerHTML = new_data;
     101                setTimeout("box.style.display='none'","1250");
     102        }
     103       
     104        function movePLItem(direction,item){
     105                                var y;
     106                                var temp;
     107                if(direction == "up")
     108                        y = item.previousSibling;
     109                else if(direction == "down")
     110                                        y = item.nextSibling;
     111                                       
     112                                if(y && y.nodeName == 'LI'){   
     113                        pl_move(y.id,item.id);
     114                       
     115                        var temp = y.innerHTML;
     116                        y.innerHTML = item.innerHTML;
     117                        item.innerHTML = temp;
     118                        Fat.fade_element(y.id,null,900,'#ffcc99','#f3f3f3');
     119                }
     120        }
     121       
     122        function setBgcolor(id, c)
     123                        {
     124                                if(id != ('pl'+nowplaying)){
     125                                var o = document.getElementById(id);
     126                                o.style.backgroundColor = c;
     127                                }
     128                        }
     129                       
     130                        function setPageTitle(){
     131                                var pages= new Array()
     132                                pages["browse"]="<?php echo t("Browse Music"); ?> ";
     133                                pages["search"]="<?php echo t("Search Music"); ?> ";
     134                                pages["random"]="<?php echo t("Create a Random Mix"); ?> ";
     135                                pages["playlists"]="<?php echo t("Load a Saved Playlist"); ?> ";
     136                                pages["stats"]="<?php echo t("Server Statistics"); ?> ";
     137                                document.getElementById("pagetitle").innerHTML = pages[page];
     138                               
     139                        }
     140                       
     141                        function getRandItems(type){
     142                          //document.getElementById("breadcrumb").innerHTML = '';
     143                          document.getElementById("rand_items").innerHTML = '';
     144                                x_getRandItems(type,getRandItems_cb);
     145                        }
     146                       
     147                        function getRandItems_cb(new_data){
     148                                document.getElementById("rand_items").innerHTML = new_data;
     149                        }
     150                       
     151                        function updateBox_cb(new_data){
     152                                document.getElementById("info").innerHTML = new_data;
     153                                document.getElementById("loading").style.display = 'none';
     154                               
     155                                if(clearbc==1)
     156                                        breadcrumb();
     157                                clearbc = 1;
     158                       
     159                        }
     160                       
     161                        function updateBox(type,itemid){
     162                                document.getElementById("loading").style.display = 'block';
     163                                x_musicLookup(type,itemid,updateBox_cb);
     164                               
     165                                if(type == 'genre' || type == 'letter'){
     166                                        bc_parenttype = '';
     167                                        bc_parentitem = '';
     168                                }
     169                                else if(type == 'album' || (type == 'artist' && bc_parenttype != '')){
     170                                        if(bc_childtype == 'all'){
     171                                                bc_parenttype = bc_childtype;
     172                                                bc_parentitem = bc_childitem;
     173                                        }
     174                                }
     175                                else if(type == 'browse' || type == 'search' || type == 'about' || type == 'prefs' || type == 'random' || type == 'admin' || type == 'playlists' || type == 'stats'){
     176
     177                                        bc_parenttype = '';
     178                                        bc_parentitem = '';
     179                                        itemid='';
     180                                        type='';
     181                                }
     182                                else{
     183                                        bc_parenttype = bc_childtype;
     184                                        bc_parentitem = bc_childitem;
     185                                }
     186                               
     187                                bc_childitem = itemid;
     188                                bc_childtype = type;
     189                               
     190                        }
     191                       
     192                        function deletePlaylist(id){
     193                                if(confirm("Are you sure you want to DELETE THIS SAVED PLAYLIST?")){
     194                                        x_deletePlaylist(id,deletePlaylist_cb);
     195                                }
     196                        }
     197                       
     198                        function deletePlaylist_cb(new_data){
     199                                // reload saved PL page
     200                                clearbc = 0;
     201                                x_musicLookup('playlists',0,updateBox_cb);
     202                                setMsgText("Saved Playlist Successfully Deleted");
     203                        }
     204                       
     205                        function plrem(item){
     206                                x_playlist_rem(item,plrem_cb);
     207                        }
     208                       
     209                        function plrem_cb(rem){
     210                                p = document.getElementById("playlist");
     211                                d_nested = document.getElementById(rem);
     212                                throwaway_node = p.removeChild(d_nested);
     213                                x_playlistInfo(plinfo_cb);
     214                        }
     215                       
     216                        function pladd(type,id){
     217                                x_playlist_add(type,id,pladd_cb);
     218                        }
     219                       
     220                        function pladd_cb(new_data){
     221                               
     222                                if(new_data[0] == 1){
     223                                        x_viewPlaylist(viewPlaylist_cb);
     224                        x_playlistInfo(plinfo_cb);
     225                                }
     226                                else{
     227                                        document.getElementById("playlist").innerHTML += new_data[0];
     228                                       
     229                                        for(var i=2; i<new_data[1]+2; i++){
     230                                                Fat.fade_element(new_data[i],null,1400,'#B4EAA2','#f3f3f3');
     231                                        }
     232                                        x_playlistInfo(plinfo_cb);
     233                                }
     234                        }
     235                       
     236                        function pl_move(item1,item2){
     237                                x_playlist_move(item1,item2,pl_move_cb);
     238                        }
     239                       
     240                        function pl_move_cb(){
     241                                        // do nothing
     242                        }
     243                       
     244                        function plclear(){
     245                                x_clearPlaylist(plinfo_cb);
     246                                document.getElementById("playlist").innerHTML = "";
     247                        }
     248                       
     249                        function plinfo_cb(new_data){
     250                                document.getElementById("pl_info").innerHTML = new_data;
     251                        }
     252                       
     253                        function breadcrumb(){
     254                                        x_buildBreadcrumb(page,bc_parenttype,bc_parentitem,bc_childtype,bc_childitem,breadcrumb_cb);
     255                        }
     256                       
     257                        function breadcrumb_cb(new_data){
     258                                //if(new_data!="")
     259                                        document.getElementById("breadcrumb").innerHTML = new_data;
     260                        }
     261                       
     262                        function play(type,id){
     263                                        document.getElementById('hidden').src = null;
     264                                        document.getElementById("hidden").src = "<?php echo music_dir(); ?>mp3act_hidden.php?type="+type+"&id="+id;
     265                        }
     266                       
     267                        function randAdd(data){
     268                                var type = data.random_type.value;
     269                                if(type == ""){
     270                                        setMsgText("You must choose a random type");
     271                                        return false;
     272                                }
     273                                var num=0;
     274                                num = data.random_count.value;
     275                                var items ='';
     276                                if(type != 'all'){
     277                                        for(var i=0;i<data.random_items.options.length;i++){
     278                                                if(data.random_items.options[i].selected == true)
     279                                                 items += data.random_items.options[i].value+" ";
     280                                        }
     281                                       
     282                                        if(items == ""){
     283                                          setMsgText("You must choose at least one random item");
     284                                          return false;
     285                                        }
     286                                }
     287                                x_randAdd(type,num,items,randadd_cb);
     288                                return false;
     289
     290                        }
     291                       
     292                        function randadd_cb(new_data){
     293                                x_viewPlaylist(viewPlaylist_cb);
     294                                x_playlistInfo(plinfo_cb);
     295                        }
     296
     297                        function play_cb(new_data){
     298                                //refresh();
     299                        }
     300                       
     301                        function setMsgText(text){
     302                                        document.getElementById("breadcrumb").innerHTML = "<span class='error'>"+text+"</span>";
     303                                        Fat.fade_element('breadcrumb',null,2000,'#F5C2C2','#ffffff');
     304                        }
     305                       
     306                        function searchMusic(form){
     307                                if(form.searchbox.value == '' || form.searchbox.value == '[<? echo t("enter your search terms"); ?>]'){
     308                                        setMsgText("You Must Enter Something to Search For");
     309                                }
     310                                else{
     311                                        document.getElementById("breadcrumb").innerHTML = "";
     312                                        x_searchMusic(form.searchbox.value,form.search_options.value,updateBox_cb);
     313                                }
     314                                return false;
     315                        }
     316                       
  • mythweb/modules/music/mp3act_functions.php

    Property changes on: mythweb/modules/music/mp3act_js.js.php
    ___________________________________________________________________
    Name: svn:executable
       + *
    
     
     1<?php
     2/**
     3 * Common Functions for the MP3Act part of the MythWeb Music module
     4 *
     5 * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/music/mp3act_functions.php $
     6 * @date        $Date: 2006-03-23 08:46:57 +0100 (Do, 23 MÀr 2006) $
     7 * @version     $Revision: 9478 $
     8 * @author      $Author: jochen $
     9 * @license     GPL
     10 *
     11 * @package     MythWeb
     12 * @subpackage  Music
     13 *
     14/**/
     15/******************************************
     16*       mp3act functions
     17*       http://www.mp3act.net
     18*       Stripped, because not all this funcionality is needed in MythWEB
     19*
     20******************************************/
     21function pic_dir()
     22    {
     23    return 'http://'.$_SERVER['HTTP_HOST'].skin_url.'img/music/';
     24}
     25
     26function music_dir()
     27    {
     28    return 'http://'.$_SERVER['HTTP_HOST'].root."music/";
     29}
     30
     31
     32function getplaylistnames(){
     33    $output='';
     34    $query = "SELECT playlist_name,hostname FROM music_saved_playlists;";
     35    $result = mysql_query($query);
     36    while($row = mysql_fetch_array($result)){
     37        if ($row[1] == "")
     38            $output .= "\"<option>".$row["playlist_name"]."</option>\";";
     39        else
     40            $output .= "\"<option>".$row["playlist_name"]."@".$row["hostname"]."</option>\";";
     41    }
     42    return $output;
     43}
     44
     45function genreform(){
     46  $query = "SELECT * FROM music_genres ORDER BY genre";
     47  $result = mysql_query($query);
     48 
     49  $output = "<select id=\"genre\" name=\"genre\" onchange=\"updateBox('genre',this.options[selectedIndex].value); return false;\">
     50    <option value=\"\" selected>".t("Choose Genre..");
     51 
     52  while($genre = mysql_fetch_array($result)){
     53    $output .= "  <option value=\"$genre[genre]\">$genre[genre]\n";
     54  }
     55  $output .= "</select>";
     56 
     57  return $output;
     58}
     59
     60function letters(){
     61        $output = "<ul class=\"music\" id=\"letters\">";
     62        $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');
     63       
     64        foreach($letters as $letter){
     65                $output .= "<li><a class=music href=\"#\" onclick=\"updateBox('letter','$letter'); return false;\">".strtoupper($letter)."</a></li>\n";
     66        }
     67        $output .= "</ul>";
     68        return $output;
     69}
     70
     71function getDropDown($type, $id){
     72        $dropdown = "";
     73        return $dropdown;
     74}
     75
     76function buildBreadcrumb($page,$parent,$parentitem,$child,$childitem){
     77        $childoutput='';
     78        $parentoutput ='';
     79        if($page == 'browse' && $child != ''){
     80                $output = "<a class=music href=\"#\" onclick=\"updateBox('browse',0); return false;\">Browse</a> &#187; ";
     81        }
     82        switch($child){
     83                case 'album':
     84                        $query = "SELECT music_albums.album_name,music_artists.artist_name,music_artists.artist_id FROM music_albums,music_artists WHERE music_albums.artist_id=music_artists.artist_id AND music_albums.album_id=$childitem";
     85                        $result = mysql_query($query);
     86                        $row = mysql_fetch_array($result);
     87                        $albums = '';
     88                        $query = "SELECT album_name,album_id FROM music_albums WHERE artist_id=$row[artist_id] ORDER BY album_name";
     89                        $result = mysql_query($query);
     90                        while($row2 = mysql_fetch_array($result)){
     91                                $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>";
     92                        }
     93                        $childoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('artist'," . $row['artist_id'] . "); return false;\">" . $row['artist_name'] . "</a><ul class=\"music\">$albums</ul></span> &#187; " . htmlentities($row['album_name']);
     94                break;
     95                case 'artist':
     96                        $query = "SELECT artist_name FROM music_artists WHERE artist_id=$childitem";
     97                        $result = mysql_query($query);
     98                        $row = mysql_fetch_array($result);
     99                        $albums = '';
     100                        $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));";
     101                        $result = mysql_query($query);
     102                        while($row2 = mysql_fetch_array($result)){
     103                                $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>";
     104                        }
     105                        $childoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('artist',$childitem); return false;\">$row[artist_name]</a><ul class=\"music\">$albums</ul></span>";
     106                break;
     107                case 'letter':
     108                        $childoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('letter','$childitem'); return false;\">".strtoupper($childitem)."</a>".letters()."</span>";
     109                break;
     110                case 'genre':
     111                        $childoutput .=  $childitem;
     112                break;
     113                case 'all':
     114                        $childoutput .=  $childitem;
     115                break;
     116       
     117        }
     118        switch($parent){
     119       
     120                case 'letter':
     121                        $parentoutput .= "<span><a class=music href=\"#\" onclick=\"updateBox('letter','$parentitem'); return false;\">".strtoupper($parentitem)."</a>".letters()."</span> &#187; ";
     122                break;
     123                case 'genre':
     124                        $query = "SELECT album_name FROM music_albums WHERE album_id=$childitem";
     125                        $result = mysql_query($query);
     126                        $row = mysql_fetch_array($result);
     127                        $parentoutput .= "<a class=music href=\"#\" onclick=\"updateBox('genre','$parentitem'); return false;\">$parentitem</a> &#187; ";
     128                break;
     129                case 'all':
     130                        $parentoutput .=  "<a class=music href=\"#\" onclick=\"updateBox('all','$parentitem'); return false;\">$parentitem</a> &#187; ";
     131                break;
     132       
     133        }
     134        if (isset($output)) {
     135          return $output.$parentoutput.$childoutput;
     136        } else {
     137          return '';
     138        }       
     139}
     140
     141function musicLookup($type,$itemid){
     142        switch($type){
     143        case 'browse':
     144    $output = "<div class=\"head\">";
     145                        $output .= "<h2 class=music>".t("Browse the Music Database")."</h2></div>";
     146                        $output .= "<p>";
     147                        $output .= "<strong>".t("By Artist Beginning With")."</strong><br/>".letters()."<br/></p>\n";
     148                        $output .= "<p><strong>".t("By Genre")."</strong><br/>\n";
     149                        $output .= genreForm()."<br/><br/>\n";
     150                        $output .= "<input type='button' value='".t("Browse All Albums")."' onclick=\"updateBox('all','All'); return false;\" class='btn2' />\n";
     151        $output .= "</p>\n";
     152
     153        break;
     154        case 'search':
     155    $output = "<div class=\"head\">";
     156                        $output .= "<h2 class=music>".t("Search the Music Database")."</h2></div>";
     157                        $output .= "<form onsubmit='return searchMusic(this)' method='get' action=''>\n";
     158                        $output .= "<p>
     159                                <strong>".t("Keywords")."</strong><br/>
     160                                <input type='text' onfocus='this.select()' name='searchbox' size='35' id='searchbox' value='[".t("enter your search terms")."]' />
     161                <br/><br/>
     162                <strong>".t("Narrow Your Search")."</strong>
     163                <br/>
     164                <select name='search_options' size='1'>
     165                        <option value='all'>".t("All Fields")."</option>
     166                        <option value='artists'>".t("Artists")."</option>
     167                        <option value='albums'>".t("Albums")."</option>
     168                        <option value='songs'>".t("Songs")."</option>
     169                </select><br/><br/>
     170                <input type='submit' value='".t("submit search")."' class='btn' /></form>";
     171                                $output .= "</p>\n";
     172
     173        break;
     174        case 'letter':
     175        if($itemid == "#"){
     176      $query = "SELECT * FROM music_artists
     177                WHERE artist_name
     178                LIKE '0%'
     179                OR artist_name LIKE '1%'
     180                OR artist_name LIKE '2%'
     181                OR artist_name LIKE '3%'
     182                OR artist_name LIKE '4%'
     183                OR artist_name LIKE '5%'
     184                OR artist_name LIKE '6%'
     185                OR artist_name LIKE '7%'
     186                OR artist_name LIKE '8%'
     187                OR artist_name LIKE '9%'
     188                ORDER BY artist_name";
     189    }else{
     190        $query = "SELECT * FROM music_artists
     191                WHERE artist_name LIKE '$itemid%'
     192                ORDER BY artist_name";
     193    }
     194    $result = mysql_query($query);
     195    $output = "<div class=\"head\">";
     196                        $output .= "<h2 class=music>".t("Artists Beginning with")." '".strtoupper($itemid)."'</h2></div>";
     197                        $output .= "<p>
     198                                <strong>".t("Artist Listing")."</strong></p>
     199                                <ul class=\"music\">";
     200                                        $count =1;
     201    while($row = mysql_fetch_array($result)){
     202    ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     203                        $output .= "<li $alt><a class=music href=\"#\" onclick=\"updateBox('artist',$row[artist_id]); return false;\" title=\"View Albums for $row[artist_name]\">$row[artist_name]</a></li>\n";
     204                        $count++;
     205                }
     206                                $output .= "</ul>\n";
     207
     208        break;
     209       
     210        case 'all':
     211                        $output = "<div class=\"head\">";
     212                        $output .= "<h2 class=music>".t("All Albums")."</h2></div> ";
     213                        $output .= "<p>
     214                                <strong>".t("Album Listing")."</strong></p>
     215                                <ul class=\"music\">";
     216                $start = $itemid;
     217                $query  = "SELECT * FROM music_albums";
     218               
     219                $result = mysql_query($query);
     220                        $count = 1;
     221                while($row = mysql_fetch_array($result)){
     222                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     223                        $output .= "<li $alt><a class=music href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"".t("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=\"".t("Play this Album Now")."\"><img src=\"".pic_dir()."play.gif\" /></a> <a class=music href=\"#\" onclick=\"updateBox('album'," . $row['album_id'] . "); return false;\" title=\"".t("View Details of")." " . $row['album_name'] . "\">" . $row['album_name'] . "</a></li>\n";
     224                       
     225                        $count++;
     226                }
     227                $output .= "</ul>\n";
     228        break;
     229       
     230        case 'album':
     231                $query = "SELECT count(music_songs.length),sum(music_songs.length) FROM music_songs GROUP BY music_songs.album_id HAVING music_songs.album_id = $itemid;";
     232                $result = mysql_query($query);
     233                $row = mysql_fetch_array($result);
     234                $anzahl = $row[0];
     235                $length = $row[1];
     236
     237                $query="SELECT music_songs.*, music_albums.album_name, music_artists.artist_name 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 WHERE music_albums.album_id = $itemid;";
     238                $result = mysql_query($query);
     239                $row = mysql_fetch_array($result);
     240               
     241                $path = $_SERVER["DOCUMENT_ROOT"].root."data/music/".substr($row["filename"],0,strrpos($row["filename"],"/"))   ;
     242                $verzeichnis = @dir($path);
     243                while($datei = @$verzeichnis->read()) {
     244                    $end = strtolower(substr($datei,-3));
     245                    if ($end == "jpg" || $end == "gif" || $end == "png")
     246                        {$album_art_arr[] = $datei;}
     247                }
     248                $verzeichnis->close();           
     249
     250                srand(microtime()*1000000);
     251                $zuf = rand(1,count($album_art_arr)-1);   
     252                $album_art = $album_art_arr[round($zuf)];
     253               
     254                $album_art = root."data/music/".substr($row["filename"],0,strrpos($row["filename"],"/"))."/".$album_art;
     255
     256                $output = "<div class=\"head\">";
     257                $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=\"".t("Add Album to Current Playlist")."\">add</a> "."</div>";
     258                $output .= "<h2 class=music>".$row['album_name']."</h2></div>";
     259                $output .= "<center><img width=200 src=\"$album_art\" /></center><br />\n";
     260                $output .= "    <strong>".t("Play Time").":</strong> $length\n";
     261                $output .= "    <br/><br/>\n";
     262                $output .= "    <strong>".t("Album Tracks")."</strong></p>\n";
     263                $output .= "<ul class=\"music\">\n";
     264                $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";
     265                $result = mysql_query($query);
     266                $count=1;
     267                while($row = mysql_fetch_array($result)){
     268                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     269                        $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";
     270                        $count++;
     271                }
     272               
     273                $output .= "</ul>\n";
     274        break;
     275        case 'genre':
     276               
     277                        $output = "<div class=\"head\">";
     278                        $output .= "<h2 class=\"music\">".t("Songs for Genre")." '$itemid'</h2></div>";
     279                        $output .= "<p>
     280                                <strong>".t("Songs")."</strong></p>
     281                                <ul class=\"music\">";
     282
     283                $query = "SELECT music_songs.*, music_artists.artist_name, music_genres.genre FROM (music_songs 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 WHERE genre='$itemid';";
     284
     285                $result = mysql_query($query);
     286                $count=1;
     287                while($row = mysql_fetch_array($result)){
     288                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     289                        $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[artist_name] - $row[name]<p>$row[numplays] Plays<br/><em>$row[length]</em></p></li>\n";
     290                        $count++;
     291                }
     292                $output .= "</ul>\n";
     293        break;
     294        case 'artist':
     295                $query = "SELECT artist_id,artist_name FROM music_artists WHERE artist_id=$itemid";
     296                $result = mysql_query($query);
     297                $row = mysql_fetch_array($result);
     298                       
     299               
     300                        $artist = $row[artist_name];
     301                       
     302                        $output = "<div class=\"head\">";
     303                        $output .= "<h2 class=\"music\">$row[artist_name] </h2></div>";
     304                        $output .= "<p>\n";
     305                        $output .= "<strong>".t("Songs")."</strong></p>\n";
     306                        $output .= "<ul class=\"music\">\n";
     307
     308                $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;";
     309                $result = mysql_query($query);
     310                $count=1;
     311                while($row = mysql_fetch_array($result)){
     312                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     313                        $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";
     314                        $count++;
     315                }
     316                $output .= "</ul><br />\n";
     317
     318                        $output .= "<p>\n";
     319                        $output .= "<strong>".t("Album's with songs from")." <i>$artist</i></strong></p>\n";
     320                        $output .= "<ul class=\"music\">\n";
     321
     322                $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));";
     323                $result = mysql_query($query);
     324                $count=1;
     325                while($row = mysql_fetch_array($result)){
     326                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     327                        $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";
     328                        $count++;
     329                }
     330                $output .= "</ul>\n";
     331        break;
     332        case 'random':
     333                        $output = "<div class=\"head\">";
     334                        $output .= "<h2 class=\"music\">".t("Random Mix Maker")."</h2></div>";
     335                        $output .= "<form onsubmit='return randAdd(this)' method='get' action=''>\n<p>";
     336                                $output .= "<strong>".t("Number of Songs")."</strong><br/>\n
     337                                <select name='random_count'>
     338                                <option value=10>10 </option>
     339                                <option value=20>20 </option>
     340                                <option value=30>30 </option>
     341                                <option value=40>40 </option>
     342                                <option value=50>50 </option>
     343         </select><br/>\n";
     344                        $output .= "<strong>".t("Random Type")."</strong><br/>\n
     345                                <select name='random_type' onchange=\"getRandItems(this.options[selectedIndex].value); return false;\" >
     346                                <option value='' >".t("Choose Type")."...</option>
     347                                <option value='artists' >".t("Artists")."</option>
     348                                <option value='genre' >".t("Genre")."</option>
     349                                <option value='albums' >".t("Albums")."</option>
     350                                <option value='all' >".t("Everything")."</option>
     351         </select><br/>\n";
     352                        $output .= "<strong>".t("Random Items")."</strong>\n<span id='rand_items'></span>
     353                        <br/><br/>";
     354                        $output .= "<input type='submit' value='".t("add mix")."' class='btn' />";
     355                        $output .= "</form></p>\n";
     356        break;
     357        case 'playlists':
     358                        $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM music_saved_playlists";
     359                        $result = mysql_query($query);
     360                       
     361                        $output = "<div class=\"head\">";
     362                        $output .= "<h2 class=\"music\">".t("Saved Playlists")."</h2></div><br />";
     363                        $output .= "<ul class=\"music\">\n";
     364                        if(mysql_num_rows($result) == 0)
     365                                $output .= t("No Public Playlists");
     366                        while ($row = mysql_fetch_array($result)){
     367                                if ($row["hostname"] == "")
     368                                    $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] ".t("Songs")." ($row[time2])</a></li>";
     369                                else
     370                                    $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] ".t("Songs")." ($row[time2])</a></li>";
     371                        }
     372                        $output .= "</ul>\n";
     373        break;
     374        case 'saved_pl':
     375                        $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM music_saved_playlists WHERE playlist_id=$itemid";
     376                        $result = mysql_query($query);
     377                        $row = mysql_fetch_array($result);
     378                        $output = "<div class=\"head\">";
     379                        $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"pladd('playlist',$row[playlist_id]); return false;\" title=\"Load Playlist\">load playlist</a></div>";
     380
     381                        $output .= "<h2 class=\"music\">".t("View Saved Playlist")."</h2></div>";
     382                        $output .= "<p><strong>".t("Playlist Info")."</strong><br/>$row[songcount] ".t("Songs")."<br/>$row[time2]</p>\n";
     383                        $output .= "<p><strong>".t("Playlist Songs")."</strong></p>\n";
     384                        $output .= "<ul class=\"music\">\n";
     385                        $songs = explode(",",$row['playlist_songs']);
     386                       
     387                        if (strlen($row['playlist_songs']) != 0)
     388                        {
     389                $count = 0;
     390                foreach($songs as $song){
     391                        $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";
     392                        $result = mysql_query($query);
     393                        $row = mysql_fetch_array($result);
     394        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     395                        $output .= "<li $alt ondblclick=\"pladd('song',$row[song_id]); return false;\" ><a class=music href=\"#\" onclick=\"pladd('song',$row[song_id]); return false;\" title=\"".t("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=\"".t("Play this Song Now")."\"><img src=\"".pic_dir()."play.gif\" /></a> $row[artist_name] - $row[name]<p>$row[numplays] ".t("Plays")."<br/><em>$row[length]</em></p></li>\n";
     396                        $count++;
     397                }
     398                        }
     399                        else
     400                        $output = " <b>".t("There are no songs in this Playlist!")."</b>";
     401                        $output .= "</ul>\n";
     402                       
     403        break;
     404        case 'stats':
     405                $query = "SELECT * FROM music_stats";
     406                        $result = mysql_query($query);
     407                        $row = mysql_fetch_array($result);
     408                        $query = "SELECT COUNT(play_id) AS songs FROM music_playhistory";
     409                        $result = mysql_query($query);
     410                        $row3 = mysql_fetch_array($result);
     411                       
     412                        $output = "<div class=\"head\">";
     413                        $output .= "<h2 class=\"music\">".t("Server Statistics")."</h2></div>";
     414                        $output .= "<p>\n";
     415                        $output .= "<a class=music href='#' onclick=\"updateBox('recentadd',0); return false;\" >".t("Recently Added Albums")."</a><br/>";
     416                        $output .= "<a class=music href='#' onclick=\"updateBox('recentplay',0); return false;\" >".t("Recently Played Songs")."</a><br/>";
     417                        $output .= "<a class=music href='#' onclick=\"updateBox('topplay',0); return false;\" >".t("Top Played Songs")."</a><br/>";
     418
     419
     420                        $output .= "</p>\n";
     421                                $output .= "<h3>".t("Local Server Statistics")."</h3>\n";
     422                          $result = mysql_query("SELECT song_id from music_songs;");   
     423                        $output .= "<p><strong>".t("Songs").":</strong> ". mysql_num_rows($result)."<br/>\n";
     424                          $result = mysql_query("SELECT album_id from music_albums;"); 
     425                        $output .= "<strong>".t("Albums").":</strong> ". mysql_num_rows($result)."<br/>\n";
     426                          $result = mysql_query("SELECT artist_id from music_artists;");       
     427                        $output .= "<strong>".t("Artists").":</strong> ". mysql_num_rows($result)."<br/>\n";
     428                          $result = mysql_query("SELECT genre_id from music_genres;"); 
     429                        $output .= "<strong>".t("Genres").":</strong> ". mysql_num_rows($result)."<br/><br/>\n";
     430                        $output .= "<strong>".t("Songs Played").":</strong> $row3[songs]<br/></p>\n";
     431
     432        break;
     433        case 'recentadd':                       
     434                        $query = "SELECT music_albums.album_name,music_albums.album_id,
     435                        music_artists.artist_name,
     436                        DATE_FORMAT(music_songs.date_entered,'%m.%d.%Y') as pubdate   
     437                        FROM music_songs,music_albums,music_artists
     438                        WHERE music_songs.album_id=music_albums.album_id
     439                        AND music_artists.artist_id=music_songs.artist_id
     440                        GROUP BY music_songs.album_id ORDER BY music_songs.date_entered DESC LIMIT 40";
     441                        $result = mysql_query($query);
     442                       
     443                        $output = "<div class=\"head\">";
     444                        $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>";
     445                        $output .= "<h2 class=\"music\">".t("Recently Added Albums")."</h2></div><ul class=\"music\">";
     446                        $count=1;
     447                while($row = mysql_fetch_array($result)){
     448                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     449                        $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>";             
     450                        $count++;
     451                }
     452                $output .= "</ul>";
     453                       
     454
     455        break;
     456        case 'topplay':                 
     457                        $query = "SELECT music_albums.album_name, music_songs.numplays, music_songs.name,
     458                        music_artists.artist_name,music_songs.song_id
     459                        FROM music_songs,music_albums,music_artists
     460                        WHERE music_songs.album_id=music_albums.album_id
     461                        AND music_artists.artist_id=music_songs.artist_id
     462                        AND music_songs.numplays > 0
     463                        ORDER BY music_songs.numplays DESC LIMIT 40";
     464                        $result = mysql_query($query);
     465                       
     466                        $output = "<div class=\"head\">";
     467                        $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"".t("Return to Statistics Page")."\">".t("back")."</a></div>";
     468                        $output .= "<h2 class=\"music\">".t("Top Played Songs")."</h2></div><ul class=\"music\">";
     469                        $count=1;
     470                while($row = mysql_fetch_array($result)){
     471                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     472                        $output .= "<li $alt><small>$row[numplays] ".t("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>";               
     473                        $count++;
     474                }
     475                $output .= "</ul>";
     476        break;
     477        case 'recentplay':                     
     478                        $query = "SELECT music_songs.name, music_songs.song_id,
     479                        music_artists.artist_name,
     480                        DATE_FORMAT(music_playhistory.date_played,'%m.%d.%Y') as playdate
     481                        FROM music_songs,music_artists,music_playhistory
     482                        WHERE music_songs.song_id=music_playhistory.song_id
     483                        AND music_artists.artist_id=music_songs.artist_id
     484                        ORDER BY music_playhistory.play_id DESC LIMIT 40";
     485                        $result = mysql_query($query);
     486                       
     487                        $output = "<div class=\"head\">";
     488                        $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>";
     489                        $output .= "<h2 class=\"music\">Recently Played Songs</h2></div><ul class=\"music\">";
     490                        $count=1;
     491                while($row = mysql_fetch_array($result)){
     492                        ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     493                        $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>";               
     494                        $count++;
     495                }
     496                $output .= "</ul>";
     497                       
     498
     499        break;
     500        }
     501       
     502        return $output;
     503               
     504}
     505
     506function getRandItems($type){
     507        $options = '';
     508        switch($type){
     509                case 'artists':
     510                        $query = "SELECT * FROM music_artists ORDER BY artist_name";
     511                        $result = mysql_query($query);
     512                        while($row = mysql_fetch_array($result)){
     513                                $options .= "<option value=$row[artist_id]>$row[artist_name]</option>\n";
     514                        }
     515                break;
     516                case 'genre':
     517                        $query = "SELECT genre_id,genre FROM music_genres ORDER BY genre";
     518                        $result = mysql_query($query);
     519                        while($row = mysql_fetch_array($result)){
     520                                $options .= "<option value=$row[genre_id]>$row[genre]</option>\n";
     521                        }
     522                break;
     523                case 'albums':
     524                        $query = "SELECT music_albums.album_id,music_albums.album_name FROM music_albums ORDER BY album_name";
     525                        $result = mysql_query($query);
     526                        while($row = mysql_fetch_array($result)){
     527                                $options .= "<option value=$row[album_id]>$row[album_name]</option>\n";
     528                        }
     529                break;
     530                case 'all':
     531                        return "<br/>".t("All Songs");
     532                break;
     533        }
     534       
     535        return "<select name='random_items' multiple size='12' style='width: 90%;'>$options</select>";
     536}
     537
     538function searchMusic($terms,$option){
     539        $query="SELECT music_songs.song_id, music_albums.album_name,music_songs.track,music_artists.artist_name,music_songs.name,SEC_TO_TIME(music_songs.length) as length
     540                                                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 ";
     541        if($option == 'all')
     542                $query .= "(music_songs.name LIKE '%$terms%' OR music_artists.artist_name LIKE '%$terms%' OR music_albums.album_name LIKE '%$terms%')";
     543        elseif($option == 'artists')
     544                $query .= "(music_artists.artist_name LIKE '%$terms%')";
     545        elseif($option == 'albums')
     546                $query .= "(music_albums.album_name LIKE '%$terms%')";
     547        elseif($option == 'songs')
     548                $query .= "(music_songs.name LIKE '%$terms%')";
     549
     550        $query .= " ORDER BY music_artists.artist_name,music_albums.album_name,music_songs.track";
     551       
     552        $result = mysql_query($query);
     553        $count = mysql_num_rows($result);
     554
     555                        $output = "<div class=\"head\">";
     556                        $output .= "<div class=\"right\"><a class=music href=\"#\" onclick=\"switchPage('search'); return false;\" title=\"Begin a New Search\">new search</a></div>";
     557                        $output .= "<h2 class=\"music\">".t("Found")." $count ".t("Results for")." '$terms'</h2></div>";       
     558                        $output .= "<ul class=\"music\">\n";
     559                if($count>0){
     560                        $count=1;
     561                        while($row = mysql_fetch_array($result)){
     562                                ($count%2 == 0 ? $alt = "class=\"alt\"" : $alt = '');
     563                                $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[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/><em>$row[length]</em></p></li>\n";
     564                                $count++;
     565                        }
     566                }
     567                $output .= "</ul>\n";
     568                return $output;
     569}
     570
     571function viewPlaylist(){
     572        $output = '';
     573        $query = "SELECT music_playlist.*, music_artists.artist_name, 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";
     574       
     575        $result=mysql_query($query);
     576       
     577        while($row = mysql_fetch_array($result)){
     578                        $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[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/>$row[time]</p></li>";
     579                }
     580        if (isset($output)) {
     581                return $output;
     582        } else {
     583          return '';
     584        }
     585}
     586function savePlaylist($pl_name, $newpl){
     587
     588        $songs = array();
     589        $time=0;
     590        $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";
     591        $result = mysql_query($query);
     592        while($row = mysql_fetch_array($result)){
     593                $songs[] = $row['song_id'];
     594                $time += $row['length'];
     595        }
     596        $songslist = implode(",",$songs);
     597        if ($newpl == 0)
     598            {
     599            $query = "INSERT INTO music_saved_playlists (playlist_name, playlist_songs, date_created, time, songcount) VALUES (\"$pl_name\",\"$songslist\",NOW(),$time,".count($songs).")";
     600            mysql_query($query);
     601            return "<h2 class=\"music\">Playlist Saved as '".$pl_name."'</h2>";
     602            }
     603        else
     604            {
     605            $arr = explode("@",$pl_name);
     606                    $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]."\"";                                                                       
     607            mysql_query($query);
     608            return "<h2 class=\"music\">Playlist '".$pl_name."' has been updated</h2>";
     609            }
     610
     611}
     612
     613function clearPlaylist(){
     614        $query = "DELETE FROM music_playlist";
     615        mysql_query($query);
     616        return "Playlist is empty";
     617}
     618function deletePlaylist($id){
     619        $query = "DELETE FROM music_saved_playlists WHERE playlist_id=$id";
     620        mysql_query($query);
     621        return 1;
     622}
     623
     624function playlistInfo(){
     625        $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";
     626        $result = mysql_query($query);
     627        $row = mysql_fetch_array($result);
     628        if($row['count'] == 0){
     629                return "Playlist is empty";
     630        }
     631        return "$row[count] Songs - $row[time]";
     632}
     633
     634function playlist_rem($itemid){
     635        $id = substr($itemid, 2);
     636        $query = "DELETE FROM music_playlist WHERE pl_id=$id";
     637        mysql_query($query);
     638        return $itemid;
     639}
     640
     641function playlist_move($item1,$item2){
     642        $item1 = substr($item1, 2);
     643        $item2 = substr($item2, 2);
     644        $row = array();
     645        $query = "SELECT pl_id,song_id FROM music_playlist WHERE pl_id=$item1 OR pl_id=$item2";
     646        $result = mysql_query($query);
     647        while($row[] = mysql_fetch_array($result)){
     648               
     649        }
     650        $query = "UPDATE music_playlist SET song_id=" . $row[0]['song_id'] . " WHERE pl_id=" . $row[1]['pl_id'];
     651                mysql_query($query);
     652                $query = "UPDATE music_playlist SET song_id=" . $row[1]['song_id'] . " WHERE pl_id=" . $row[0]['pl_id'];
     653
     654        mysql_query($query);
     655}
     656
     657function playlist_add($type,$itemid){
     658       
     659        switch($type){
     660        case 'song':
     661                $query = "INSERT INTO music_playlist (song_id) VALUES (N$itemid)";
     662                mysql_query($query);
     663                $id = mysql_insert_id();
     664                $query = "SELECT music_artists.artist_name, 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";
     665                $result = mysql_query($query);
     666                $row = mysql_fetch_array($result);
     667               
     668                $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[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/>$row[length]</p></li>";
     669                $output[] = 1;
     670                $output[] = 'pl'.$id;
     671                return $output;
     672        break;
     673        case 'album':
     674                $items='';
     675                $output = array();
     676                $query = "SELECT music_songs.song_id,music_songs.name,music_artists.artist_name,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";
     677                $result = mysql_query($query);
     678                while($row = mysql_fetch_array($result)){
     679                  $query = "INSERT INTO music_playlist (song_id) VALUES(" . $row['song_id'] . ")";
     680                        mysql_query($query);
     681                        $id = mysql_insert_id();
     682                        $output[] = 'pl'.$id;
     683                        $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[artist_name] - $row[name]<p>Album: $row[album_name]<br/>Track: $row[track]<br/>$row[length]</p></li>";
     684                }
     685                $text[] = $items;
     686                $num[] = count($output);
     687                $text = array_merge($text,$num);
     688                $output = array_merge($text,$output);
     689                return $output;
     690
     691        break;
     692        case 'playlist':
     693                clearPlaylist();
     694                $query = "SELECT * FROM music_saved_playlists WHERE playlist_id=$itemid LIMIT 1";
     695                $result = mysql_query($query);
     696                $row = mysql_fetch_array($result);
     697                $songs = explode(",",$row['playlist_songs']);
     698               
     699                foreach($songs as $song){
     700                        $query = "INSERT INTO music_playlist (song_id) VALUES($song)";
     701                        mysql_query($query);
     702                }
     703                $output[0] = 1;
     704                return $output;
     705
     706        break;
     707        }
     708}
     709
     710function randAdd($type,$num=0,$items){
     711                $tmp = '';
     712                $query = '';
     713                $items2 = explode(" ",trim($items));
     714                $items = '';
     715                $output = '';
     716               
     717                switch($type){
     718                        case 'artists':
     719                                foreach($items2 as $item){
     720                                        $items .= " artist_id=$item OR";
     721                                }                               
     722                                $items = preg_replace("/OR$/","",$items);
     723                                $query = "SELECT music_songs.song_id FROM music_songs WHERE (".$items.") ORDER BY rand()+0 LIMIT $num";
     724                                $result = mysql_query($query);
     725                                while($row = @mysql_fetch_array($result)){
     726                                    $query = "INSERT into music_playlist (song_id) values($row[song_id])";
     727                                    mysql_query($query);
     728                                }
     729                                $output[0] = 1;
     730                        break;
     731                        case 'genre':
     732                                foreach($items2 as $item){
     733                                        $items .= " genre_id=$item OR";
     734                                }                               
     735                                $items = preg_replace("/OR$/","",$items);
     736                                $query = "SELECT music_songs.song_id FROM music_songs WHERE (".$items.") ORDER BY rand()+0 LIMIT $num";
     737                                $result = mysql_query($query);
     738                                while($row = @mysql_fetch_array($result)){
     739                                    $query = "INSERT into music_playlist (song_id) values($row[song_id])";
     740                                    mysql_query($query);
     741                                }
     742                                $output[0] = 1;
     743                        break;
     744                        case 'albums':
     745                                foreach($items2 as $item){
     746                                        $items .= " album_id=$item OR";
     747                                }                               
     748                                $items = preg_replace("/OR$/","",$items);
     749                                $query = "SELECT music_songs.song_id FROM music_songs WHERE (".$items.") ORDER BY rand()+0 LIMIT $num";
     750                                $result = mysql_query($query);
     751                                while($row = @mysql_fetch_array($result)){
     752                                    $query = "INSERT into music_playlist (song_id) values($row[song_id])";
     753                                    mysql_query($query);
     754                                }
     755                                $output[0] = 1;
     756                        break;
     757                        case 'all':
     758                                $query = "SELECT music_songs.song_id FROM music_songs ORDER BY rand()+0 LIMIT $num";
     759                                $result = mysql_query($query);
     760                                while($row = @mysql_fetch_array($result)){
     761                                    $query = "INSERT into music_playlist (song_id) values($row[song_id])";
     762                                    mysql_query($query);
     763                                }
     764                                $output[0] = 1;
     765                        break;
     766                }
     767                       
     768                return $output;   
     769}
     770
     771function play($type,$id){
     772    $tmp = '';
     773    $query = '';
     774       
     775    session_cache_limiter('nocache');
     776    header("Content-Type: audio/mpegurl;");
     777    header("Content-Disposition: inline; filename=\"playlist.m3u\"");
     778    header("Expires: 0");
     779    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     780    header("Pragma: nocache");
     781    $tmp .= "#EXTM3U\n";
     782               
     783    if($type=='song'){         
     784        $query = "SELECT music_songs.song_id,music_artists.artist_name,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";
     785    }
     786    elseif($type=='album'){
     787        $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 music_songs.album_id=$id ORDER BY music_songs.track";
     788    }
     789    elseif($type=='pl'){
     790        $query = "SELECT music_songs.song_id,music_artists.artist_name,music_songs.name,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";                     
     791    }   
     792   
     793    $result = mysql_query($query);
     794    while($row = mysql_fetch_array($result)){
     795        $length = $row['length'];
     796        /*if($GLOBALS[sample_mode] == 1){
     797            $length = floor($row['length']/4);
     798        }*/
     799        $tmp .= "#EXTINF:$length,$row[artist_name] - $row[name]\n";
     800        $tmp .= music_dir()."mp3act_playstream.php?i=$row[song_id]\n";
     801        }                       
     802    return $tmp;   
     803    exit;
     804}
     805
     806/*
     807function download($album){
     808        $query = "SELECT music_songs.filename,
     809        music_artists.artist_name,
     810        music_albums.album_name
     811        FROM music_songs,music_artists,music_albums
     812        WHERE music_songs.album_id=$album
     813        AND music_songs.album_id=music_albums.album_id
     814        AND music_songs.artist_id=music_artists.artist_id LIMIT 1";
     815       
     816        $result = mysql_query($query);
     817        $row = mysql_fetch_array($result);
     818        $dir = dirname($row['filename']);
     819       
     820        $test = new zip_file("/tmp/album_$album.zip");
     821        $test->set_options(array('inmemory'=>0,'storepaths'=>0,'level'=>0,'method'=>0,'prepend'=>"$row[artist_name] - $row[album_name]"));
     822        $test->add_files($dir);
     823       
     824        $test->store_files($dir);
     825        $test->create_archive();
     826       
     827        header("Content-type:application/zip");
     828
     829        $header = "Content-disposition: attachment; filename=\"";
     830        $header .= "album_$album.zip";
     831        $header .= "\"";
     832        header($header);
     833        header("Content-length: " . filesize("/tmp/album_$album.zip"));
     834        header("Content-transfer-encoding: binary");
     835        header("Pragma: no-cache");
     836        header("Expires: 0");
     837        $chunksize = 1*(1024*1024); // how many bytes per chunk
     838  $buffer = '';
     839  $handle = fopen("/tmp/album_$album.zip", 'rb');
     840  if ($handle === false) {
     841   return false;
     842  }
     843  while (!feof($handle)) {
     844   $buffer = fread($handle, $chunksize);
     845   print $buffer;
     846  }
     847  fclose($handle);
     848  //readfile("/tmp/album_$album.zip");
     849        unlink("/tmp/album_$album.zip");
     850        //$test->download_file();
     851}*/
     852
     853function updateNumPlays($num){
     854        $query = "UPDATE music_songs SET numplays=numplays+1";
     855        $query .= " WHERE song_id=$num";
     856        mysql_query($query);
     857 
     858        $query = "INSERT INTO music_playhistory VALUES (NULL,$num,NOW())";
     859        mysql_query($query);
     860}
     861
     862function streamPlay($id){
     863  $query = "SELECT music_artists.artist_name,
     864  music_songs.name,
     865  music_songs.bitrate,
     866  music_songs.length as length,
     867  music_songs.filename as filename,
     868  music_songs.size as size
     869  FROM music_songs,music_artists
     870  WHERE music_songs.song_id=$id
     871  AND music_artists.artist_id=music_songs.artist_id";
     872 
     873  $result=mysql_query($query);
     874  $row = mysql_fetch_array($result);
     875        updateNumPlays($id);
     876        clearstatcache(); // flush buffer
     877 
     878        $file['name'] = basename($row['filename']);
     879        $mp3out = stripslashes($row['filename']);
     880       
     881        $size=$row['size'];
     882
     883        header("Content-Type: audio/mpeg");
     884        header("Content-Length: $size");
     885        header("Content-Disposition: filename=$row[artist_name] - $row[name]");
     886        $bitrate = $row[$bitrate] / 1000;
     887        // Run the command, and read back the results at the bitrate size + 1K.
     888        $blocksize=($bitrate*1024)+1024;
     889        $totaldata=0;
     890        /*if($rate!=0 && $mode==1){
     891                $temp = @popen($mp3out, "r");
     892                while (($data = @fread($temp, $blocksize )) && ($totaldata <= $size ) )
     893                        {echo $data; $totaldata+=$blocksize; }
     894                pclose($temp);
     895        }
     896        elseif($rate!=0 ){
     897                $temp = @popen($mp3out, "r");
     898                while ($data = @fread($temp, $blocksize) )
     899                        {echo $data; }
     900                pclose($temp);
     901        }
     902        elseif($mode==1 ){*/
     903                $temp = fopen($mp3out, "r");
     904                while (!feof($temp)  && ($totaldata <= $size ) )
     905                        {$data = @fread($temp, $blocksize); echo $data; $totaldata+=$blocksize; }
     906                fclose($temp);
     907        /*}
     908        else{
     909                $temp = @fopen($mp3out, "r");
     910                while (!feof($temp) )
     911                        {$data = @fread($temp, $blocksize); echo $data; }
     912                fclose($temp);
     913        //}*/
     914        exit;
     915}
     916?>
     917 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
     3include("mp3act_functions.php");
     4
     5// Play the Music
     6if ($_GET['id'] != '')
     7    echo play($_GET['type'],$_GET['id']);
     8?>
  • mythweb/modules/music/init.php

    Property changes on: mythweb/modules/music/mp3act_hidden.php
    ___________________________________________________________________
    Name: svn:executable
       + *
    
     
    1616// First, we should check to see that MythMusic is configured.
    1717// Make sure to turn off fatal errors in case the table isn't there.
    1818    $db->disable_fatal_errors();
    19     $has_music = $db->query_col('SELECT COUNT(*) FROM musicmetadata');
     19    $has_music = $db->query_col('SELECT COUNT(*) FROM music_songs');
    2020    $db->enable_fatal_errors();
    2121    $db->error(false);
    2222
  • mythweb/modules/music/mp3act_fat.js

     
     1var 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
     2include_once("modules/music/mp3act_functions.php");
     3set_time_limit(0);
     4streamPlay($_GET['i'])
     5?>
     6 No newline at end of file
  • mythmusic/mythmusic/metadata.cpp

    Property changes on: mythweb/modules/music/mp3act_playstream.php
    ___________________________________________________________________
    Name: svn:executable
       + *
    
     
    4444    rating = rhs->Rating();
    4545    lastplay = rhs->LastPlayStr();
    4646    playcount = rhs->Playcount();
     47    bitrate = rhs->Bitrate();
     48    filesize = rhs->Filesize();
    4749    compilation = rhs->Compilation();
    4850    id = rhs->ID();
    4951    filename = rhs->Filename();
     
    6264void Metadata::persist()
    6365{
    6466    MSqlQuery query(MSqlQuery::InitCon());
    65     query.prepare("UPDATE musicmetadata set 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 ;");
    6870    query.bindValue(":RATING", rating);
    6971    query.bindValue(":PLAYCOUNT", playcount);
    7072    query.bindValue(":LASTPLAY", lastplay);
     
    98100    QString sqlfilename = filename.remove(0, m_startdir.length());
    99101
    100102    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 ));");
    104113    query.bindValue(":FILENAME", sqlfilename.utf8());
    105114
    106115    if (query.exec() && query.isActive() && query.size() > 0)
     
    146155    // Don't update the database if a song with the exact same
    147156    // metadata is already there
    148157    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   
    157174    query.bindValue(":ARTIST", artist.utf8());
    158175    query.bindValue(":COMPILATION_ARTIST", compilation_artist.utf8());
    159176    query.bindValue(":ALBUM", album.utf8());
     
    167184    if (query.exec() && query.isActive() && query.size() > 0)
    168185        return;
    169186
    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 ) "
    175307                  "VALUES "
    176                   "(:ARTIST,  :COMPILATION_ARTIST,:ALBUM,     :TITLE,   "
     308                  "(:ARTIST,  :ALBUM, :COMPILATION_ARTIST,    :TITLE,   "
    177309                  " :GENRE,   :YEAR,              :TRACKNUM,  :LENGTH,  "
    178310                  " :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);
    183315    query.bindValue(":TITLE", title.utf8());
    184     query.bindValue(":GENRE", genre.utf8());
     316    query.bindValue(":GENRE", GenreID);
    185317    query.bindValue(":YEAR", year);
    186318    query.bindValue(":TRACKNUM", tracknum);
    187319    query.bindValue(":LENGTH", length);
     
    190322    query.bindValue(":DATE_ADDED",  QDateTime::currentDateTime());
    191323    query.bindValue(":DATE_MOD",    QDateTime::currentDateTime());
    192324    query.bindValue(":FORMAT", format);
     325    query.bindValue(":FILESIZE", filesize);
     326    query.bindValue(":BITRATE", bitrate);
    193327   
     328   
    194329    query.exec();
    195 
     330//    cout << query.executedQuery() << endl;
    196331    // easiest way to ensure we've got 'id' filled.
    197332    fillData();
    198333}
     
    341476
    342477    MSqlQuery query(MSqlQuery::InitCon());
    343478
    344     query.prepare("UPDATE musicmetadata    "
     479    query.prepare("UPDATE music_songs    "
    345480                  "SET artist   = :ARTIST,   "
    346481                  "    album    = :ALBUM,    "
    347482                  "    title    = :TITLE,    "
     
    353488                  "    compilation        = :COMPILATION,   "
    354489                  "    compilation_artist = :COMPILATION_ARTIST, "
    355490                  "    format             = :FORMAT "
    356                   "WHERE intid = :ID;");
     491                  "WHERE song_id = :ID;");
    357492    query.bindValue(":ARTIST",             artist.utf8());
    358493    query.bindValue(":ALBUM",              album.utf8());
    359494    query.bindValue(":TITLE",              title.utf8());
     
    427562    if (title == "")
    428563        return;
    429564
    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";
    433577
    434578    if (album != "")
    435         thequery += " AND album = :ALBUM";
     579        thequery += " AND album_name = :ALBUM";
    436580    if (artist != "")
    437         thequery += " AND artist = :ARTIST";
     581        thequery += " AND artist_name = :ARTIST";
    438582    if (compilation_artist != "")
    439583        thequery += " AND compilation_artist = :COMPILATION_ARTIST";
    440584
     
    478622        return;
    479623       
    480624    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 ));");           
    484637    query.bindValue(":ID", id);
    485638       
    486639    if (query.exec() && query.isActive() && query.numRowsAffected() > 0)
     
    491644        artist = QString::fromUtf8(query.value(1).toString());
    492645        compilation_artist = QString::fromUtf8(query.value(2).toString());
    493646        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();
    505657
    506658        if (!filename.contains("://"))
    507659            filename = m_startdir + filename;
     
    644796void AllMusic::resync()
    645797{
    646798    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;";
    652804
     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
    653818    QString filename, artist, album, title;
    654819
    655820    MSqlQuery query(MSqlQuery::InitCon());
     
    694859                query.value(0).toInt(),
    695860                query.value(10).toInt(),
    696861                query.value(12).toInt(),
     862                query.value(15).toInt(), //bitrate
     863                query.value(16).toInt(), //filesize
    697864                query.value(11).toString(),
    698865                (query.value(13).toInt() > 0),
    699866                query.value(14).toString());
  • mythmusic/mythmusic/dbcheck.cpp

     
    99#include "mythtv/mythcontext.h"
    1010#include "mythtv/mythdbcon.h"
    1111
    12 const QString currentDatabaseVersion = "1005";
     12const QString currentDatabaseVersion = "1006";
    1313
    1414static void UpdateDBVersionNumber(const QString &newnumber)
    1515{
     
    323323
    324324        performActualUpdate(updates, "1005", dbver);
    325325    }
     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, 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, 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, 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, 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    }
    326349}
    327350
  • mythmusic/mythmusic/metaioid3v2.h

     
    2323   
    2424private:
    2525    int getTrackLength(QString filename);
     26    int getTrackBitRate(QString filename);
    2627
    2728    QString getRawID3String(union id3_field *pField);
    2829    void removeComment(id3_tag *pTag, const char* pLabel, const QString desc = "");
  • mythmusic/mythmusic/playlist.cpp

     
    326326    all_other_playlists->clear();
    327327
    328328    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;");
    333337    query.bindValue(":DEFAULT", "default_playlist_storage");
    334338    query.bindValue(":BACKUP", "backup_playlist_storage");
    335     query.bindValue(":HOST", my_host);
    336339
    337340    if (query.exec() && query.isActive() && query.size() > 0)
    338341    {
     
    468471    }
    469472   
    470473    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);
    476474
     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
    477489    if (query.exec() && query.size() > 0)
    478490    {
    479491        while (query.next())
     
    498510void Playlist::loadPlaylistByID(int id, QString a_host)
    499511{
    500512    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;");
    504515    query.bindValue(":ID", id);
    505     query.bindValue(":HOST", a_host);
     516//    query.bindValue(":HOST", a_host);
    506517
    507518    query.exec();
    508519
     
    603614
    604615    QString theQuery;
    605616
    606     theQuery = "SELECT intid FROM musicmetadata ";
     617    theQuery = "SELECT song_id FROM music_songs ";
    607618
    608619    if (whereClause.length() > 0)
    609620      theQuery += whereClause;
     
    717728    QString orderBy;
    718729    int limitTo;
    719730   
    720     query.prepare("SELECT smartplaylistid, matchtype, orderby, limitto "
     731    query.prepare("SELECT music_smartplaylistid, matchtype, orderby, limitto "
    721732                  "FROM smartplaylist WHERE categoryid = :CATEGORYID AND name = :NAME;");
    722733    query.bindValue(":NAME", name.utf8());
    723734    query.bindValue(":CATEGORYID", categoryID);
     
    748759    QString whereClause = "WHERE ";
    749760   
    750761    query.prepare("SELECT field, operator, value1, value2 "
    751                   "FROM smartplaylistitem WHERE smartplaylistid = :ID;");
     762                  "FROM music_smartplaylistitem WHERE smartplaylistid = :ID;");
    752763    query.bindValue(":ID", ID);
    753764    query.exec();
    754765    if (query.isActive() && query.numRowsAffected() > 0)
     
    787798        return;
    788799
    789800    fillSonglistFromSongs();
     801    MSqlQuery query(MSqlQuery::InitCon());
    790802
    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 ;");
    793821    query.bindValue(":ID", playlistid);
    794822
    795823    if (query.exec() && query.isActive() && query.size() > 0)
    796824    {
    797         query.prepare("UPDATE musicplaylist 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 ;");
    799827        query.bindValue(":LIST", raw_songlist);
    800828        query.bindValue(":NAME", a_name.utf8());
     829        query.bindValue(":SONGCOUNT", songcount);
     830        query.bindValue(":PLAYTIME", playtime);
    801831        query.bindValue(":ID", playlistid);
    802832    }
    803833    else
    804834    {
    805         query.prepare("INSERT INTO musicplaylist (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);");
    807837        query.bindValue(":LIST", raw_songlist);
    808838        query.bindValue(":NAME", a_name.utf8());
     839        query.bindValue(":SONGCOUNT", songcount);
     840        query.bindValue(":PLAYTIME", playtime);
    809841    }
    810842
    811843    query.exec();
     
    827859    }
    828860
    829861    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    }
    830880   
    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);");
    834883    query.bindValue(":NAME", name.utf8());
    835884    query.bindValue(":HOST", a_host);
     885    query.bindValue(":SONGCOUNT", songcount);
     886    query.bindValue(":PLAYTIME", playtime);
    836887
    837888    query.exec();
    838889
    839     query.prepare("SELECT playlistid FROM musicplaylist WHERE "
    840                   "name = :NAME AND hostname = :HOST ;");
     890    query.prepare("SELECT playlist_id FROM music_saved_playlists WHERE "
     891                  "playlist_name = :NAME AND hostname = :HOST;");
    841892    query.bindValue(":NAME", name.utf8());
    842893    query.bindValue(":HOST", a_host);
    843894
     
    12101261    }
    12111262
    12121263    MSqlQuery query(MSqlQuery::InitCon());
    1213     query.prepare("DELETE FROM musicplaylist WHERE playlistid = :ID ;");
     1264    query.prepare("DELETE FROM music_saved_playlists WHERE playlist_id = :ID ;");
    12141265    query.bindValue(":ID", kill_me);
    12151266
    12161267    if (query.exec() || query.size() < 1)
  • mythmusic/mythmusic/smartplaylist.cpp

     
    3333static SmartPLField SmartPLFields[] =
    3434{
    3535    { "",              "",                               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 },
    3939    { "Genre",         "genre",                          ftString,   0,    0,    0 },
    4040    { "Year",          "year",                           ftNumeric,  1900, 2099, 2000 },
    41     { "Track No.",     "tracknum",                       ftNumeric,  0,    99,   0 },
     41    { "Track No.",     "track",                       ftNumeric,  0,    99,   0 },
    4242    { "Rating",        "rating",                         ftNumeric,  0,    10,   0 },
    43     { "Play Count",    "playcount",                      ftNumeric,  0,    9999, 0 },
     43    { "Play Count",    "numplays",                      ftNumeric,  0,    9999, 0 },
    4444    { "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 },
    4646    { "Last Play",     "FROM_DAYS(TO_DAYS(lastplay))",   ftDate,     0,    0,    0 },
    4747    { "Date Imported", "FROM_DAYS(TO_DAYS(date_added))", ftDate,     0,    0,    0 },
    4848};       
     
    656656   
    657657    MSqlQuery query(MSqlQuery::InitCon());
    658658    QString querystr;
    659     querystr = QString("SELECT DISTINCT %1 FROM musicmetadata ORDER 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);
    660660       
    661661    query.exec(querystr);
    662662    if (query.isActive() && query.numRowsAffected())
     
    815815    }
    816816   
    817817    MSqlQuery query(MSqlQuery::InitCon());
    818     query.prepare("INSERT INTO smartplaylistitem (smartplaylistid, field, operator,"
     818    query.prepare("INSERT INTO music_smartplaylistitem (smartplaylistid, field, operator,"
    819819                  " value1, value2)"
    820820                  "VALUES (:SMARTPLAYLISTID, :FIELD, :OPERATOR, :VALUE1, :VALUE2);");
    821821    query.bindValue(":SMARTPLAYLISTID", smartPlaylistID);
     
    11301130{
    11311131    bPlaylistIsValid = true;
    11321132   
    1133     QString sql = "select count(*) from musicmetadata ";
     1133    QString sql = "select count(*) from music_songs ";
    11341134    sql += getWhereClause();
    11351135   
    11361136    MSqlQuery query(MSqlQuery::InitCon());
     
    11771177   
    11781178    MSqlQuery query(MSqlQuery::InitCon());
    11791179    // 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) "
    11811181                "VALUES (:NAME, :CATEGORYID, :MATCHTYPE, :ORDERBY, :LIMIT);");
    11821182    query.bindValue(":NAME", name.utf8());
    11831183    query.bindValue(":CATEGORYID", categoryid);
     
    11931193   
    11941194    // get smartplaylistid
    11951195    int ID;
    1196     query.prepare("SELECT smartplaylistid FROM smartplaylist "
     1196    query.prepare("SELECT smartplaylistid FROM music_smartplaylist "
    11971197                  "WHERE categoryid = :CATEGORYID AND name = :NAME;");
    11981198    query.bindValue(":CATEGORYID", categoryid);
    11991199    query.bindValue(":NAME", name.utf8());
     
    12531253    int ID;
    12541254   
    12551255    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;");
    12571257    query.bindValue(":NAME", name.utf8());
    12581258    query.bindValue(":CATEGORYID", categoryid);
    12591259    if (query.exec())
     
    12851285    uint rowCount;
    12861286   
    12871287    query.prepare("SELECT field, operator, value1, value2 "
    1288                   "FROM smartplaylistitem WHERE smartplaylistid = :ID "
     1288                  "FROM music_smartplaylistitem WHERE smartplaylistid = :ID "
    12891289                  "ORDER BY smartplaylistitemid;");
    12901290    query.bindValue(":ID", ID);
    12911291    if (!query.exec())
     
    13921392    // insert new smartplaylistcategory
    13931393
    13941394    MSqlQuery query(MSqlQuery::InitCon());
    1395     query.prepare("INSERT INTO smartplaylistcategory (name) "
     1395    query.prepare("INSERT INTO music_smartplaylistcategory (name) "
    13961396                "VALUES (:NAME);");
    13971397    query.bindValue(":NAME", categoryEdit->text().utf8());
    13981398   
     
    14381438       
    14391439    // change the category     
    14401440    MSqlQuery query(MSqlQuery::InitCon());
    1441     query.prepare("UPDATE smartplaylistcategory SET name = :NEW_CATEGORY "
     1441    query.prepare("UPDATE music_smartplaylistcategory SET name = :NEW_CATEGORY "
    14421442                  "WHERE name = :OLD_CATEGORY;");
    14431443    query.bindValue(":OLD_CATEGORY", categoryCombo->currentText().utf8());
    14441444    query.bindValue(":NEW_CATEGORY", categoryEdit->text().utf8());
     
    14591459{
    14601460    QString sql, whereClause, orderByClause, limitClause;
    14611461   
    1462     sql = "SELECT " + fields + " FROM musicmetadata ";
     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 ";
    14631463    whereClause = getWhereClause();
    14641464    orderByClause = getOrderByClause();
    14651465    if (limitSpinEdit->value() > 0)
     
    15061506
    15071507void SmartPlaylistEditor::showResultsClicked(void)
    15081508{
    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");
    15101510   
    15111511    SmartPLResultViewer *resultViewer = new SmartPLResultViewer(gContext->GetMainWindow(), "resultviewer");
    15121512    resultViewer->setSQL(sql);
     
    15351535    categoryCombo->clear();
    15361536    MSqlQuery query(MSqlQuery::InitCon());
    15371537
    1538     if (query.exec("SELECT name FROM smartplaylistcategory ORDER BY name;"))
     1538    if (query.exec("SELECT name FROM music_smartplaylistcategory ORDER BY name;"))
    15391539    {
    15401540        if (query.isActive() && query.numRowsAffected() > 0)
    15411541        {
     
    15631563   
    15641564    // get playlist ID
    15651565    int ID;
    1566     query.prepare("SELECT smartplaylistid FROM smartplaylist WHERE name = :NAME "
     1566    query.prepare("SELECT smartplaylistid FROM music_smartplaylist WHERE name = :NAME "
    15671567                  "AND categoryid = :CATEGORYID;");
    15681568    query.bindValue(":NAME", name.utf8());
    15691569    query.bindValue(":CATEGORYID", categoryid);
     
    15881588    }
    15891589   
    15901590    //delete smartplaylist items
    1591     query.prepare("DELETE FROM smartplaylistitem WHERE smartplaylistid = :ID;");
     1591    query.prepare("DELETE FROM music_smartplaylistitem WHERE smartplaylistid = :ID;");
    15921592    query.bindValue(":ID", ID);
    15931593    if (!query.exec())
    15941594        MythContext::DBError("Delete smartplaylist items", query);
    15951595
    15961596    //delete smartplaylist
    1597     query.prepare("DELETE FROM smartplaylist WHERE smartplaylistid = :ID;");
     1597    query.prepare("DELETE FROM music_smartplaylist WHERE smartplaylistid = :ID;");
    15981598    query.bindValue(":ID", ID);
    15991599    if (!query.exec())
    16001600        MythContext::DBError("Delete smartplaylist", query);
     
    16101610    MSqlQuery query(MSqlQuery::InitCon());
    16111611   
    16121612    //delete all smartplaylists with the selected category
    1613     query.prepare("SELECT name FROM smartplaylist "
     1613    query.prepare("SELECT name FROM music_smartplaylist "
    16141614                  "WHERE categoryid = :CATEGORYID;");
    16151615    query.bindValue(":CATEGORYID", categoryid);
    16161616    if (!query.exec())
     
    16291629    }
    16301630   
    16311631    // delete the category
    1632     query.prepare("DELETE FROM smartplaylistcategory WHERE categoryid = :ID;");
     1632    query.prepare("DELETE FROM music_smartplaylistcategory WHERE categoryid = :ID;");
    16331633    query.bindValue(":ID", categoryid);
    16341634    if (!query.exec())
    16351635        MythContext::DBError("Delete smartplaylist category", query);
     
    16421642{   
    16431643    int ID;
    16441644    MSqlQuery query(MSqlQuery::InitCon());
    1645     query.prepare("SELECT categoryid FROM smartplaylistcategory "
     1645    query.prepare("SELECT categoryid FROM music_smartplaylistcategory "
    16461646                  "WHERE name = :CATEGORY;");
    16471647    query.bindValue(":CATEGORY", category.utf8());
    16481648
     
    20232023    categoryCombo->clear();
    20242024    MSqlQuery query(MSqlQuery::InitCon());
    20252025
    2026     if (query.exec("SELECT name FROM smartplaylistcategory ORDER BY name;"))
     2026    if (query.exec("SELECT name FROM music_smartplaylistcategory ORDER BY name;"))
    20272027    {
    20282028        if (query.isActive() && query.numRowsAffected() > 0)
    20292029        {
     
    20452045    listbox->clear();
    20462046
    20472047    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 "
    20492049                  "ORDER BY name;");
    20502050    query.bindValue(":CATEGORYID", categoryid);
    20512051                   
  • mythmusic/mythmusic/metadata.h

     
    1818    Metadata(QString lfilename = "", QString lartist = "", QString lcompilation_artist = "",
    1919             QString lalbum = "", QString ltitle = "", QString lgenre = "",
    2020             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 = "",
    2222             bool lcompilation = false, QString lformat="")
    2323            {
    2424                filename = lfilename;
     
    3535                id = lid;
    3636                rating = lrating;
    3737                playcount = lplaycount;
     38                bitrate = lbitrate;
     39                filesize = lfilesize;
    3840                lastplay = llastplay;
    3941                compilation = lcompilation;
    4042                changed = false;
     
    5961                rating = other.rating;
    6062                lastplay = other.lastplay;
    6163                playcount = other.playcount;
     64                bitrate = other.bitrate;
     65                filesize = other.filesize;
    6266                compilation = other.compilation;
    6367                show = other.show;
    6468                changed = false;
     
    97101    int Playcount() { return playcount; }
    98102    void setPlaycount(int lplaycount) { playcount = lplaycount; }
    99103
     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
    100110    unsigned int ID() { return id; }
    101111    void setID(int lid) { id = lid; }
    102112   
     
    158168    int rating;
    159169    QString lastplay;
    160170    int playcount;
     171    int bitrate;
     172    int filesize;
    161173    bool compilation;
    162174     
    163175    unsigned int id;
  • mythmusic/mythmusic/main.cpp

     
    7676    {
    7777        Metadata *data = decoder->getMetadata();
    7878        if (data) {
     79            QFileInfo fi1( filename );
     80            data->setFilesize( fi1.size() );   
    7981            data->dumpToDatabase();
    8082            delete data;
    8183        }
     
    9092    QString name(filename);
    9193    name.remove(0, directory.length());
    9294    MSqlQuery query(MSqlQuery::InitCon());
    93     query.prepare("DELETE FROM musicmetadata WHERE "
     95    query.prepare("DELETE FROM music_songs WHERE "
    9496                  "filename = :NAME ;");
    9597    query.bindValue(":NAME", filename.utf8());
    9698    query.exec();
     
    260262
    261263    MSqlQuery query(MSqlQuery::InitCon());
    262264    query.exec("SELECT filename, date_modified "
    263                "FROM musicmetadata "
     265               "FROM music_songs "
    264266               "WHERE filename NOT LIKE ('%://%')");
    265267
    266268    int counter = 0;
     
    558560
    559561
    560562    MSqlQuery count_query(MSqlQuery::InitCon());
    561     count_query.exec("SELECT COUNT(*) FROM musicmetadata;");
     563    count_query.exec("SELECT COUNT(*) FROM music_songs;");
    562564
    563565    bool musicdata_exists = false;
    564566    if (count_query.isActive())
  • mythmusic/mythmusic/metaioid3v2.cpp

     
    174174{
    175175    QString artist = "", compilation_artist = "", album = "", title = "",
    176176            genre = "";
    177     int year = 0, tracknum = 0, length = 0;
     177    int year = 0, tracknum = 0, length = 0, bitrate = 0;
    178178    bool compilation = false;
    179179    id3_file *p_input = NULL;
    180180   
     
    251251    }
    252252
    253253    length = getTrackLength(filename);
     254    bitrate = getTrackBitRate(filename);
    254255
    255256    // If we don't have title and artist or don't have the length return NULL
    256257    if ((title.isEmpty() && artist.isEmpty()) || length<=0)
     
    261262    }
    262263
    263264    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);
    265267                                     
    266268    retdata->setCompilation(compilation);
    267269
     
    378380    return alt_length;
    379381}
    380382
     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 */
     390int MetaIOID3v2::getTrackBitRate(QString filename)
     391{
     392    struct mad_stream stream;
     393    struct mad_header header;
     394    mad_timer_t timer;
    381395
     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
    382490inline QString MetaIOID3v2::getRawID3String(union id3_field *pField)
    383491{
    384492    QString tmp = "";