Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
User Documentation and How To's:
jrTwitter add song link to stream twits - Quick and dirty
musichive-net



Joined: 24 Jan 2009
Posts: 266

Posted: 07/09/11 03:43 
Hi,

Have been working on my own module for twitter, but after 3 days got frustrated with the amount of work as well as stupidity of the fact that I'm doing something that has already been done.
My biggest problem with the Jamroom Twitter module was lack of links which makes this module a bit pointless in terms of site/music/artist marketing.

Anyway, got the module today, spent half an hour looking through the files and here is a quick and dirty way of getting links (I hope Brian or Kyle will incorporate this as it's really easy but in case they don't anyone who implements this 'code' will have to redo it every time there is an update to the module).

It is an effect of 15 minutes of testing, thus I cannot guarantee it will work on every website. I will make it cleaner once I find some time, but here is the DIRTY version:

Version for Nova and Nova-based artist themes:

goto->modules/jrTwitter/jrTwitter/stream.php open it and scroll to line 48. You will find:

Code

        $req = "SELECT s.song_name, b.band_name,
                  FROM {$jamroom_db['song_info']} s
             LEFT JOIN {$jamroom_db['band_info']} b ON s.band_id = b.band_id
                 WHERE s.song_id = '". dbEscapeString($_REQUEST['song_id']) ."'
                   AND b.band_id = '". dbEscapeString($_REQUEST['band_id']) ."'
                 LIMIT 1";

after "SELECT" add "s.song_id, b.band_url"

no go to line 55 hit enter and into a new line paste the following:

Code
$my_media_url = "http://your_domain_name.TLD/" . $_song['band_url'] . "/?song=" . $_song['song_id'];

change "your_domain_name.TLD" to your website's address

now after line 68 add a coma (,) and hit enter. New line should contain:

Code
'{URL}'    => $my_media_url

No coma at the end of this line!
That's it for stream.php. Your file should look like this (from line 47 down):

Code

    elseif (checkType($_REQUEST['song_id'],'number_nz')) {
        $req = "SELECT s.song_name, s.song_id, b.band_name, b.band_url
                  FROM {$jamroom_db['song_info']} s
             LEFT JOIN {$jamroom_db['band_info']} b ON s.band_id = b.band_id
                 WHERE s.song_id = '". dbEscapeString($_REQUEST['song_id']) ."'
                   AND b.band_id = '". dbEscapeString($_REQUEST['band_id']) ."'
                 LIMIT 1";
        $_song = dbQuery($req,'SINGLE');
        $media_name = $_song['song_name'];
   $my_media_url = "http://examplesite.net/" . $_song['band_url'] . "/?song=" . $_song['song_id'];
    }
    else {
        return false;
    }
    // if we don't get song/video info, we don't want to do anything
    if (!isset($_song) || !is_array($_song)) {
        return false;
    }
    $_rep = array(
      '{ARTIST}' => $_song['band_name'],
      '{NAME}'   => $media_name,
      '{URL}'    => $my_media_url
    );
   
    $tweet = str_replace(array_keys($_rep),$_rep,$tweet);

    return $tweet;
}


before we go to language files, if you are using a Cobalt3, Sage or your own artist theme but based on the aforementioned you have to make one adjustment to your line 56 code. It should look like the following:

Code
$my_media_url = "http://examplesite.net/" . $_song['band_url'] . "/song_" . $_song['song_id'] . ".php";


Now, as You might have noticed we have added a new variable {URL}, so we want users to know about.
go to the module/jrTwitter/langage/

and add the following to the "ul" in line 87:

Code
<li><tt>{URL}</tt>: url to the song played</li>


and make your line 92 look like this:

Code
Currently listening to: {ARTIST} - {NAME} @ {URL}

or whatever you please, just remember that {URL} is the actual address to your song.

also, before you start wondering why the link from twitter leads nowhere make sure your song_list.cfg file of your theme has the following line:
in nova:

Code
song_details.tpl       | song_{SONG_ID}.php

in cobalt3:

Code
song_list.tpl       | song_{SONG_ID}.php


Hope it helps someone,
Mike

P.S. As I said I can clean it up, but I'm hoping this will be included in the new version of the module.
P.P.S. You can apply the same principle to other options, i.e. stream video, play radio etc.

I do NOT take responsibility for damage done due to use of this hack, please test it first!

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 07/13/11 13:31 
Support has actually already been added in to the next version for URL variables, and will be configurable by skin/theme designers.

Kyle


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
musichive-net



Joined: 24 Jan 2009
Posts: 266

Posted: 07/13/11 17:14 
Hi,

Ahhh, that's great! I suppose I should have asked before posting this Wink

P.S. Is there any way to remove fields like LoFi and VIDEO?
I have disabled access to LOFI as well as video in media settings for the quota, and also set twit actions for video and channel to 'no' for that quota and yet related options in the module show to artists.

Take care,
Mike

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 07/13/11 18:07 
That's a good idea - I've added that in as well.

Kyle


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
SK1



Joined: 15 Feb 2010
Posts: 66

Posted: 07/16/11 12:11 
1) When is the next version for this module coming out ?

2) Do we have a working-DEMO somewhere ?


smith.kyle:
That's a good idea - I've added that in as well.

Kyle


Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 07/16/11 13:23 
I'm not sure about a release date yet - hopefully by the end of the summer. We don't currently have a demo of it - sorry!

Kyle


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
User Documentation and How To's

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.