Tuna

Tuna v1.9.9

univrsal

Active Member
Still having issues when trying to use spotify or any music platform, I can't figure out the "song outputs info" section. I just get "The provided data is incorrect, make sure the format isn't empty and the path is valid"

Any help would be greatly appreciated, I've spent hours on youtube and reading and can't figure out what I'm missing.
Are you running the latest version? Can you post your obs studio log after you configured an output? Also did you watch the setup video:
 

Ginfio

New Member
I don't understand the instructions at all. "as long as the files are tagged correctly, check with mp3tag.de...". How do I know if the files are tagged correctly?
I've tried this multiple times and it never worked for me (WIth VLC ). Can someone please rewrite the instructions with what all the other files we need to find and how we need to configure those files. ? thx
 

rarie

New Member
Are you running the latest version? Can you post your obs studio log after you configured an output? Also did you watch the setup video:
Thank you very much, got it working. Much appreciated mate
 

kydda

New Member
idk how to login and create acc on your git page, but i really want function with which i can try download title(like it did with cover) using web browser function
1646390738068.png

(i using youtube music desktop from github/t-ch with built-in tuna-obs plugin)
 

Sanandraous

New Member
Is there a line anywhere in this code that I can adjust it to add multiple spaces after the artist name that is posted to the artist.txt file so that the displayed text in OBS will have a space between the artist name and song as it continuously scrolls?

Sorry I'm just getting into this and it is a bit overwhelming.

Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Zyphen's Now Playing</title>
  <link rel="stylesheet" href="SongStyle.css">
  <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
  <script>
    var newSong;
    var newArtist;
    var shown = false;
    function hideText() {
      $("#artist").animate({
        marginLeft: "-100px",
        opacity: 0
      }, 300);
      $("#song").animate({
        marginLeft: "-100px",
        opacity: 0
      }, 300);

      document.getElementById("song").classList.remove("scrolling");
      document.getElementById("artist").classList.remove("scrolling");

    }

    function updateText() {
      document.getElementById("artist").innerHTML = newArtist;
      document.getElementById("song").innerHTML = newSong;
    }

    function showText() {
      if(document.getElementById("artist").clientWidth > 260){
        $("#artist").animate({
          marginLeft: "290px",
          opacity: 1
        }, 300, function() {
          $("#artist").css("margin-left", "7px");
          console.log("changed");
        });
        }
      else{
        $("#artist").animate({
          marginLeft: "7px",
          opacity: 1
        }, 300);}
      if(document.getElementById("song").clientWidth > 260){
        $("#song").animate({
          marginLeft: "290px",
          opacity: 1
        }, 300, function() {
          console.log("lngsong")
          $("#song").css("margin-left", "7px");
        });}
      else {
        $("#song").animate({
        marginLeft: "7px",
        opacity: 1
      }, 300);}

      if(document.getElementById("song").clientWidth > 260) setTimeout(function(){document.getElementById("song").classList.add("scrolling");}, 300);
      if(document.getElementById("artist").clientWidth > 260) setTimeout(function(){document.getElementById("artist").classList.add("scrolling");}, 300);
      console.log(document.getElementById("song").clientWidth);
    }

    function checkUpdate() {
      $.get("Artist.txt", function(art) {
        newArtist = art.replace(/&/g, "&amp;");
      }).then(
      $.get("Track.txt", function(sng) {
        newSong = sng.replace(/&/g, "&amp;");
      })).then(displayData);

      setTimeout(checkUpdate, 2000);
    }

    function displayData() {
      if(newSong != document.getElementById("song").innerHTML) {
        if(newSong.length > 1 && !shown) {
          $("#bigdiv").animate({
            marginLeft: "0px",
          }, 500)
          shown = true;
        }
        if(newSong.length < 1 && shown) {
          $("#bigdiv").animate({
            marginLeft: "-500px",
          }, 500)
          shown = false;
        }
        console.log("New song, old song: " + document.getElementById("song").innerHTML + " new song: " + newSong);
        hideText();
        setTimeout(updateText, 300);
        setTimeout(showText, 400);
        var imgpath = "Artwork.png?t=" + newSong + newArtist;
        document.getElementById("image").setAttribute("src", imgpath);
        $("#image2").fadeOut(500, function(){
          document.getElementById("image2").setAttribute("src", imgpath);
          $("#image2").show();
        });
      }
    }

    $(document).ready(checkUpdate);
  </script>
</head>
<body>
  <div id=bigdiv>
    <img id=image>
    <img id=image2 src="Artwork.png">
    <div id=smalldiv>
      <p id=artist></p>
      <br>
      <p id=song></p>
    </div>
  </div>
</body>
</html>
 

univrsal

Active Member
Is there a line anywhere in this code that I can adjust it to add multiple spaces after the artist name that is posted to the artist.txt file so that the displayed text in OBS will have a space between the artist name and song as it continuously scrolls?

Sorry I'm just getting into this and it is a bit overwhelming.

Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Zyphen's Now Playing</title>
  <link rel="stylesheet" href="SongStyle.css">
  <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
  <script>
    var newSong;
    var newArtist;
    var shown = false;
    function hideText() {
      $("#artist").animate({
        marginLeft: "-100px",
        opacity: 0
      }, 300);
      $("#song").animate({
        marginLeft: "-100px",
        opacity: 0
      }, 300);

      document.getElementById("song").classList.remove("scrolling");
      document.getElementById("artist").classList.remove("scrolling");

    }

    function updateText() {
      document.getElementById("artist").innerHTML = newArtist;
      document.getElementById("song").innerHTML = newSong;
    }

    function showText() {
      if(document.getElementById("artist").clientWidth > 260){
        $("#artist").animate({
          marginLeft: "290px",
          opacity: 1
        }, 300, function() {
          $("#artist").css("margin-left", "7px");
          console.log("changed");
        });
        }
      else{
        $("#artist").animate({
          marginLeft: "7px",
          opacity: 1
        }, 300);}
      if(document.getElementById("song").clientWidth > 260){
        $("#song").animate({
          marginLeft: "290px",
          opacity: 1
        }, 300, function() {
          console.log("lngsong")
          $("#song").css("margin-left", "7px");
        });}
      else {
        $("#song").animate({
        marginLeft: "7px",
        opacity: 1
      }, 300);}

      if(document.getElementById("song").clientWidth > 260) setTimeout(function(){document.getElementById("song").classList.add("scrolling");}, 300);
      if(document.getElementById("artist").clientWidth > 260) setTimeout(function(){document.getElementById("artist").classList.add("scrolling");}, 300);
      console.log(document.getElementById("song").clientWidth);
    }

    function checkUpdate() {
      $.get("Artist.txt", function(art) {
        newArtist = art.replace(/&/g, "&amp;");
      }).then(
      $.get("Track.txt", function(sng) {
        newSong = sng.replace(/&/g, "&amp;");
      })).then(displayData);

      setTimeout(checkUpdate, 2000);
    }

    function displayData() {
      if(newSong != document.getElementById("song").innerHTML) {
        if(newSong.length > 1 && !shown) {
          $("#bigdiv").animate({
            marginLeft: "0px",
          }, 500)
          shown = true;
        }
        if(newSong.length < 1 && shown) {
          $("#bigdiv").animate({
            marginLeft: "-500px",
          }, 500)
          shown = false;
        }
        console.log("New song, old song: " + document.getElementById("song").innerHTML + " new song: " + newSong);
        hideText();
        setTimeout(updateText, 300);
        setTimeout(showText, 400);
        var imgpath = "Artwork.png?t=" + newSong + newArtist;
        document.getElementById("image").setAttribute("src", imgpath);
        $("#image2").fadeOut(500, function(){
          document.getElementById("image2").setAttribute("src", imgpath);
          $("#image2").show();
        });
      }
    }

    $(document).ready(checkUpdate);
  </script>
</head>
<body>
  <div id=bigdiv>
    <img id=image>
    <img id=image2 src="Artwork.png">
    <div id=smalldiv>
      <p id=artist></p>
      <br>
      <p id=song></p>
    </div>
  </div>
</body>
</html>
This isn't my code. I don't know where you got it from but you should ask whoever wrote it.
 

ExoFury

New Member
I cannot get your browser widget to work on windows :(

http://localhost:1608/ receives data, I see title and cover changing there
Untitled.jpg


But file:///C:/Program%20Files/obs-studio/data/obs-plugins/tuna/widget.html just stays static with text "Title" and "Artist" and the progress bar at half both in OBS and in browser ( I presume it should work and can preview it directly in browser too, no? )

Untitled2.jpg


While I know html and css but I suck at javascript and have no idea why it does not fetch the data.
 

univrsal

Active Member
I cannot get your browser widget to work on windows :(

http://localhost:1608/ receives data, I see title and cover changing there
View attachment 81536

But file:///C:/Program%20Files/obs-studio/data/obs-plugins/tuna/widget.html just stays static with text "Title" and "Artist" and the progress bar at half both in OBS and in browser ( I presume it should work and can preview it directly in browser too, no? )

View attachment 81537

While I know html and css but I suck at javascript and have no idea why it does not fetch the data.
Open the console (F12 > Console) and see what it says
 

ExoFury

New Member
Open the console (F12 > Console) and see what it says

Initially is empty, both on Firefox and Chrome, When I activate XHR I get this:

01.jpg

02.jpg

03.jpg


Also, as an extra info, the placeholder is fetched and applied as I changed it with a transparent one as it can be seen in the screenshots.
 

ExoFury

New Member
Initially is empty, both on Firefox and Chrome, When I activate XHR I get this:

Also, as an extra info, the placeholder is fetched and applied as I changed it with a transparent one as it can be seen in the screenshots.

Oh... I found out something. Most of my media was .mkv and today I threw in an .mp4 into the playlist and for that one it seems to be kinda working. Any idea why it does not work for .mkv files (using VLC Video Source) ?

Also, I said "kinda" because the cover is not showing in OBS widget, while in browser it shows fine:

browser logo.jpg

obs logo.jpg
 

ExoFury

New Member
I'm so sorry for the consecutive replies but as I can't seem to be able to edit or delete my previous posts I want to keep you updated on what I discovered:

1. I was wrong with the .mkv and .mp4
It turns our that it was the fact that the "Artist" meta was missing from the files and the /mp4 file had that one. After I added that value to a .mkv file that was previously not working, that one worked too. So i solved this mystery: file meta must have both title and artist for widget to work and update

2. About the cover.. it seems the last update from OBS broke something:
obs-browser: Not allowed to load local resource: file:///C:/Users/Claudiu/AppData/Roaming/vlc/art/artistalbum/Triskell%20Interactive/Dotemu/art.jpg?0.3054270173054079 (source: http://absolute/C:/Program Files/obs-studio/data/obs-plugins/tuna/widget.html:0)

As I looked it up, it turns out that file:/// is no longer supported and managed to "fix" it by changing this line in your widget's js:
JavaScript:
document.getElementById('cover').src = data['cover_url'].replace("file://", "http://absolute") + '?' + Math.random();

This "fix" makes the cover no longer work in browsers but seems to work in OBS just fine. Tho, i think it would be a healthier js if you could, maybe for next update, make the json return the cover url with http://absolute instead of file:// so that replace is not needed.

3. After playing around some more, I noticed the json does not provide 2 metadata values which Tuna can output as text files (track number and disc number). Could those be added to the json too? :D I actually need 2 more values to add to my widget regardless of which of these are but mentioned those 2 since they already can be exported as txt
Or.. is there a way I could edit the json to include those values too, considering I have limited coding abilities ^^
 

MoumouDesPoils

New Member
Hello,
I have a problem with the html widget, with Spotify.

It works perfectly, but it updates every 20 seconds or so. As a result, the progress bar and the remaining time are never up to date...

When I open the browser source, even if I spam the cache refresh button (or if I spam F5 when I open the .html in my internet browser), it doesn't update. So I have the impression that it is the .html file which is not "modified" quickly enough.

Ine the Tuna settings, refresh speed is at 500ms, I tried to change it, but nothing :(

Do you have an idea, please?
Thank you in advance.
 
Last edited:

MoumouDesPoils

New Member
Hello,
I have a problem with the html widget, with Spotify.

It works perfectly, but it updates every 20 seconds or so. As a result, the progress bar and the remaining time are never up to date...

When I open the browser source, even if I spam the cache refresh button (or if I spam F5 when I open the .html in my internet browser), it doesn't update. So I have the impression that it is the .html file which is not "modified" quickly enough.

Ine the Tuna settings, refresh speed is at 500ms, I tried to change it, but nothing :(

Do you have an idea, please?
Thank you in advance.

I'm using :
Windows 10 Pro, OBS
OBS 27.2.3 (64 bits)
Tuna v1.6.1.
Spotify pour Windows : 1.1.81.604.gccacfc8c
Tuna 1.PNGTuna 2.PNG
 

Giodinho

New Member
Hello,
I have a problem with the html widget, with Spotify.

It works perfectly, but it updates every 20 seconds or so. As a result, the progress bar and the remaining time are never up to date...

When I open the browser source, even if I spam the cache refresh button (or if I spam F5 when I open the .html in my internet browser), it doesn't update. So I have the impression that it is the .html file which is not "modified" quickly enough.

Ine the Tuna settings, refresh speed is at 500ms, I tried to change it, but nothing :(

Do you have an idea, please?
Thank you in advance.

I've got the exact same issue.. However I just use the standard .txt method... It takes 30 seconds to refresh, and then it stays refreshing for 3 seconds and then it waits another 30 secs.. It's really annoying, other than that it's an amazing plugin
 

univrsal

Active Member
Hello,
I have a problem with the html widget, with Spotify.

It works perfectly, but it updates every 20 seconds or so. As a result, the progress bar and the remaining time are never up to date...

When I open the browser source, even if I spam the cache refresh button (or if I spam F5 when I open the .html in my internet browser), it doesn't update. So I have the impression that it is the .html file which is not "modified" quickly enough.

Ine the Tuna settings, refresh speed is at 500ms, I tried to change it, but nothing :(

Do you have an idea, please?
Thank you in advance.
I'm using :
Windows 10 Pro, OBS
OBS 27.2.3 (64 bits)
Tuna v1.6.1.
Spotify pour Windows : 1.1.81.604.gccacfc8c
View attachment 82202View attachment 82203
You have to use your own API Credentials because Spotify sometimes limits the requests if there are too many:
 

MediumRareRen

New Member
Okay, so setting Tuna up and for some reason- its picking up the song album cover- but not the title or artist text (just keeps coming up with 'The provided data is incorrect. Make sure the format isnt empty and the path is valid')
 
Top