Radio Song Album Artwork Cover by YouTube


Hits: 3512  

An album cover is the front / other side of the packaging of a commercially released audio recording product, or album.

You can find online APIs or Websites where artwork available

– Amazon
– LastFM
– Soundcloud
– Apple iTune
– Google Play
– Gracenote
– Free Music Archive

And many more ….

But YouTube is the best source where you can get Album / Song Cover Image for every Title

YouTube provide gdata API to search songs as video title to get image

Deprecated Features for YouTube API v2.0

YouTube Data API (v3)

http://gdata.youtube.com/feeds/base/videos?q=title:<search term>

youtube-artwork.php

<?php
$q = isset($_REQUEST['q'])?$_REQUEST['q']:"";

//thumbnail -> sqDefault, hqDefault

// orderby -> title, relevance, published

?>
 
 
<div id="videos"></div>
 
<!-- Include the latest jQuery library -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
 
<script type="text/javascript">

jQuery.getJSON('https://gdata.youtube.com/feeds/api/videos?q=<?php echo $q; ?>&max-results=1&v=2&alt=jsonc&orderby=relevance', function(data) {
    var output="<ul>";
    for (var i in data.data.items) {
        
		output+="<li><img src='" + data.data.items[i].thumbnail.hqDefault + "' /></li>";
		output+="<li>" + data.data.items[i].title + "</li>";
		
    }
	var output="</ul>";
	
    document.getElementById("videos").innerHTML=output;
	
	});

</script>

How you can get cover image?

http://www.domain.com/youtube-artwork.php?q=Ek%20Villain%20-%20Galliyan

song album artwork

JSON2CSV – convert json files to csv


Hits: 7899  

JSON2CSV is a python script that converts json data to a csv file.

json2csv

json2csv.py_.txt

Download above text file “json2csv.py_.txt” then rename “json2csv.py”

>> python json2csv.py “input.json” “output.csv”

JSON – input.json

[
{
“createdAt”: “2014-02-20T18:15:56.818Z”,
“fbID”: “34534534534”,
“lessonQuestions”: 5,
“lessonScore”: 2750,
“lesson_no”: 2,
“objectId”: “htmsuPr6F6”,
“updatedAt”: “2014-02-22T15:42:38.166Z”
},
{
“createdAt”: “2014-02-21T16:45:52.550Z”,
“fbID”: “100001132788807”,
“lessonQuestions”: 5,
“lessonScore”: 1100,
“lesson_no”: 3,
“objectId”: “xgmJxEyBHl”,
“updatedAt”: “2014-02-22T18:14:38.107Z”
}
]

CSV – output.csv

createdAt, fbID, lessonQuestions, lessonScore, lesson_no, objectId, updatedAt
2014-02-20T18:15:56.818Z, 34534534534, 5, 2750, 2, htmsuPr6F6, 2014-02-22T15:42:38.166Z
2014-02-21T16:45:52.550Z, 100001132788807, 5, 1100, 3, xgmJxEyBHl, 2014-02-22T18:14:38.107Z

Ref: https://github.com/vladikk/json2csv

PHP Get Radio Stream Type Version


Hits: 3259  

Live Audio Streaming, Internet Radio Player

Shoutcast1 Stream: http://shoutcast-server:port/;audio.mp3
Shoutcast2 Stream: http://shoutcast-server:port/streamname;audio.mp3
Icecast2 Stream: http://icecast-server:port/streamname

Shoutcast server stream need “;” OR “;audio.mp3” at end of stream URL, so change accordingly

 

<?php

function radioStreamType($stream)
{

$pp = parse_url($stream);
$type = strstr($pp[‘path’], ‘;audio.mp3’);

if($type==’;audio.mp3′)
{
if($pp[‘path’]==”/;audio.mp3″ || $pp[‘path’]==”;audio.mp3″) return “shoutcast1”;
return “shoutcast2”;
}
else
{
return “icecast”;
}
}

?>

 

shoutcast-version-1

radioStreamType(“http://shoutcast-server:port/;audio.mp3”);

shoutcast-version-2

radioStreamType(“http://shoutcast-server:port/streamname;audio.mp3”);

icecast

radioStreamType(“http://icecast-server:port/streamname”);

ICECAST SHOUTCAST METADATA

Re Stream Radio Shoutcast / Icecast using Node JS


Hits: 5573  

Re-stream Radio (Shoutcast/Icecast) Stream using Node.JS and get Metadata current playing song title… Use port forwarding to hide real shoutcast IP …. Avoid PHP script to damage Server with too many calls on radio server

Start Restream

> node radio.js

node.js>node radio.js
Server running at http://192.168.1.4:8007

Radio Stream connected!
{ ‘icy-notice1’: ‘<BR>This stream requires <a href=”http’,
‘icy-notice2’: ‘SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>’,
‘icy-name’: ‘Radio HSL – Hit Hai Toh Bajega!’,
‘icy-genre’: ‘Indian Hindi Top40’,
‘icy-url’: ‘http’,
‘content-type’: ‘audio/mpeg’,
‘icy-pub’: ‘1’,
‘icy-metaint’: ‘32768’,
‘icy-br’: ’64’ }
StreamTitle=’Bullett Raja – Tamanche Pe Disco [1e92]’;StreamUrl=”;

Get MetaData

> node radio-metadata.js

node.js>node radio-metadata.js
Server listening on port 8079
Radio Stream connected!
StreamTitle=’Bullett Raja – Tamanche Pe Disco [1e92]’;StreamUrl=”;

Output in browser:
“StreamTitle=’Bullett Raja – Tamanche Pe Disco [1e92]’;StreamUrl=”;\u0000\u0000\u0000\u0000\u0000″

Install Centova Cast


Hits: 4044  

Centova Cast is an internet radio stream hosting control panel. It is used for hosting radio streams and manage Radio Server like ShoutCast and IceCast. You can manage Auto DJ using Centova Cast v2 Auto DJ System plus Server Control Panel.

Centova Cast Admin

System Requirements for Centova Cast: You can install it on any Linux-based servers.

Operating system: CentOS 4/5/6, RHEL, Debian Linux
Database server: MySQL v4.1+, v5.0, v5.1, or v5.5
Streaming server: SHOUTcast v2.0, SHOUTcast v1.9, IceCast v2.x
Streaming source: ices-cc, sc_trans v2.0, ices v2, ices v0.4, ezstream 0.5.3, sc_trans 0.4.0

# apt-get install liblwp-useragent-determined-perl libconfig-tiny-perl libnet-snmp-perl libxml-simple-perl libconfig-simple-perl libmp3lame-dev libxml2-dev

# apt-get install libxml2 libvorbis-dev libogg-dev libxslt1-dev libcurl3-gnutls libogg0 libspeex1 libtheora0 libvorbis0a libxslt1.1

# wget -O install.sh install.centova.com/LICENSEKEY
# chmod a+x ./install.sh

# ./install.sh –shoutcast-all
# /usr/local/centovacast/sbin/update –add shoutcast1
# apt-get install ia32-libs

# ./install.sh –icecast-all

Detecting the end of video using OSMPlayer


Hits: 2623  

I was working on video ads solution using OSMPlayer. So, It was needed to detect video finish event in OSMPlayer …

The Open Standard Media Player (OSMPlayer) is an all-in-one video player. It is open source (MIT) video player for web media, including Red5, Wowza, HTML5, YouTube, Vimeo, Limelight CDN, Kaltura, and Flash.

I have onComplete() method in JavaScript… but I was not sure how to bind video ended event in this JavaScript API …

<script type="text/javascript">
  $(function() {
    $("video").osmplayer({
      width: '100%',
      height: '600px'
    });
  });

$(function() {
        minplayer.get(‘media’, function(media) { 
        media.bind(‘ended’, function() {
       //The video is done!
       alert(“video complete :)”);
});
});
});

</script>

<video src="VIDEO-SOURCE" poster="VIDEO-POSTER-IMAGE"></video>

Thanks to Travis Tidwell

Secure Expired MP3 File


Hits: 3105  

Secure Expired MP3 File can be used for hiding real mp3 link inside html source using base64_encode, mcrypt_encrypt, base64_decode, mcrypt_decrypt and md5. MP3 link will be expired in few seconds then it will return No Access Page to protect MP3 files to hot linked.

I was working on Secured & Expired MP3 Link in HTML5 MP3 Player. Hope you already read previous article “Amazon S3 Expiring Link”

These functions are also useful when you need to secure & expire media links …

Remote Secure Token
Secure Token Plugin with PHP
– JavaScript Encryption Library

Secure Expired MP3

Demo: http://demo.svnlabs.com/securemp3/player.php

PayPal auto redirect credit card user to website after payment


Hits: 4067  

I have a problem on my Pay Per Video Website (PPV), Guests normally watch preview of videos for few seconds then PayPal Screen appear to watch full version of video content.

payperview-app-payment-screen

Pay Per Plugin for HTML5 Media – Pay Per Plugin for HTML5 Media Plugin is embedded stand-alone, e-commerce-powered JavaScript and iFramed widget for Audio/Video. – See more at: http://html5plus.svnlabs.com/shop/pay-per-plugin-for-html5-media/#.UsuLItIW2So

I am using paypal form …

<form action=”<?php echo $paypal_link; ?>” target=”_top” method=”post” name=”payPalForm”>
<input type=”hidden” name=”business” value=”<?php echo $business_email;?>”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”item_name” value=”<?php echo $item_name; ?>”>
<input type=”hidden” name=”item_number” value=”<?php echo $item_number; ?>”>
<input type=”hidden” name=”amount” value=”<?php echo sprintf(“%01.2f”, $amount); ?>”>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”currency_code” value=”<?php echo $currency_code; ?>”>
<input type=”hidden” name=”handling” value=”0″>
<input type=”hidden” name=”rm” value=”2″ >
<input type=”hidden” name=”cancel_return” value=”<?php echo $siteurl; ?>cancel.php”>
<input type=”hidden” name=”return” value=”<?php echo $siteurl; ?>success.php”>
<input type=”image” src=”https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online!”>
<img alt=”” border=”0″ src=”https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>

 

I have enabled auto return ON and auto return URL in paypal settings already ….

Auto Return URL

When customers pay using paypal they easily redirected to PPV website … but if someone (guest) pay from credit card .. they have to click on link to redirect back to website …. 🙁

PayPal Auto Redirect to Website

Solution:

You can find more info here Merchant Services from PayPal – Payment Solutions for Your Business

PayPal Standard Payments is designed in such a way if a customer pays as guest (they don’t have a PayPal Account), after they complete the checkout process, PayPal will offer to open PayPal Account or click on the link to return them to PPV website. Customers “must” click on the link in order to return to your web site.

You can use either PayPal Payments Pro or Advanced, if you want the customer to remain on your web site for the checkout process. Advanced PayPal method enable customer to remains on PPV website. The PayPal process work thru a window or frame on your website.

Merchant Services from PayPal - Payment Solutions for Your Business

PayPal Pro and Advanced are available in additional monthly costs as well as the transaction processing fees.
Pro is $30 a month, Advanced is $5 a month. 🙂

Google App Engine – Downloading source code


Hits: 3430  

I am working on my old project on Google App Engine… so I need to download old source code from Google App Engine ….

We can download source code for application by appcfg.py with the download_app action in the Python SDK command-line tool:

> appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>

But it is giving error …

D:\Program Files\Google\google_appengine>appcfg.py download_app -A svnlabs -V 1 E:/AppEngine/svnlabs
Usage: appcfg.py [options] download_app -A app_id [ -V version ]

appcfg.py: error: “download_app” expects one non-option argument, found 3. 🙁

D:\Program Files\Google\google_appengine>appcfg.py download_app -A svnlabs -V 1 E:/AppEngine/svnlabs

D:\Program Files\Google\google_appengine>appcfg.py download_app help
Usage: appcfg.py [options] download_app -A app_id [ -V version ]

appcfg.py: error: You must specify an app ID via -A or – -application. 

Solution

> appcfg.py download_app – -application=<your_app_id> – -version=<your_app_version> <output-dir> 🙂

D:\Program Files\Google\google_appengine>appcfg.py download_app – -application=svnlabs E:/AppEngine/svnlabs
01:50 PM Host: appengine.google.com
01:50 PM Fetching file list…
Email: svnlabs@domain.com
Password for svnlabs@domain.com:

Use an application-specific password instead of your regular account password.
See http://www.google.com/support/accounts/bin/answer.py?answer=185833
However, now the recommended way to log in is using OAuth2. See
https://developers.google.com/appengine/docs/python/tools/uploadinganapp#Python_Password-less_login_with_OAuth2

Google IssuedAuthSubTokens accesscode

Email: svnlabs@domain.com
Password for svnlabs@domain.com:
01:55 PM Fetching files…
01:55 PM [1/41] WEB-INF/lib/script-10.jar
01:55 PM [2/41] WEB-INF/classes/META-INF/jdoconfig.xml
01:55 PM [3/41] svnlabs.php

.
.
.

GAE - Download