'use strict';

var Media = require('./media');

module.exports = {
    /**
     * Creates and returns the markdown for a playlist comment
     * 
     * @param {object} job Beanstalkd job
     * @returns {string}
     */
    buildPlaylistComment: function(job) {
        var text = job.media.title + "\r\n\r\n";
        if (job.media.type == "yt") {
            text += Media.getYoutubeLink(job.media.id) + "\r\n\r\n";
        }
        text += "Queued By: [" + job.queueby + "](https://pienudes.com/playlists/user/" + job.queueby + ")\r\n";
    
        return text;
    },
    
    /**
     * Creates and returns the markdown for the "Now Playing" sidebar widget
     * 
     * @param {object} job Beanstalkd job
     * @returns {string}
     */
    buildNowPlaying: function(job) {
        var text = "----\r\n\r\n**Now Playing**  \r\n";
        text += '*' + job.media.title + "*  \r\n";
        if (job.media.type == "yt") {
            text += Media.getYoutubeLink(job.media.id) + "  \r\n";
        }
        text += "Queued By: [" + job.queueby + "](https://pienudes.com/playlists/user/" + job.queueby + ")\r\n\r\n----\r\n";
    
        return text;
    },
    
    /**
     * Creates and returns the text for a tweet
     * 
     * @param {object} job Beanstalkd job
     * @returns {string}
     */
    buildTweet: function(job) {
        var text = job.queueby.substring(0, 10) + " is playing " + job.media.title.substring(0, 15) + " at https://pienudes.com/r/lobby #chat #music ";
        text += Media.getYoutubeLink(job.media.id);
        
        return text;
    }
};
@@ -248,32 +248,131 @@
 function(job) %7B%0A
+        if (job.queueby%5B0%5D == %22@%22) %7B%0A            job.queueby = job.queueby.substring(1);%0A        %7D%0A
         var text
@@ -396,32 +396,32 @@
 e + %22%5Cr%5Cn%5Cr%5Cn%22;%0A
-
         if (job.
@@ -869,32 +869,131 @@
 function(job) %7B%0A
+        if (job.queueby%5B0%5D == %22@%22) %7B%0A            job.queueby = job.queueby.substring(1);%0A        %7D%0A
         var text
@@ -1492,32 +1492,32 @@
 string%7D%0A     */%0A
-
     buildTweet: 
@@ -1524,32 +1524,131 @@
 function(job) %7B%0A
+        if (job.queueby%5B0%5D == %22@%22) %7B%0A            job.queueby = job.queueby.substring(1);%0A        %7D%0A
         var text

Fix for @username