Trouble Getting Album Covers To Work In New Version

JChapkin

13-11-2009 03:14:09

I am having trouble getting album covers to work in the new one. I tried changing it in the new settings part of the browser to no avail and I also tried in "Get-cover" and tried 100 things that never worked. All of my album covers are named front.jpg, could I get some help for the coding for the new version? Thank you in advance!

Phil

13-11-2009 04:57:28

Can you post your get-cover.vibe file located by default* at C\Program Files (x86)\Vibe Streamer\sites\default\vibe\resources\ajax\plugin\nowplaying?

[code2ydzbpcx]<?@ include file="/_private/include/utils.vibe" ?>
<?
var shareId = request.getParameter("shareId");
var hash = request.getParameter("hash");

if ( !isNaN(shareId) && hash.length>0 )
{
var shareManager = server.getShareManager();

var share = shareManager.findShareByDbId(shareId);
if ( share!=null && share.checkPermission(request.getUser(),request.getRemoteAddress()) )
{
var databaseManager = server.getDatabaseManager();
var connection = databaseManager.getConnection("index",false);
if ( connection!=null )
{
var query = "SELECT [hash] FROM [items] WHERE [shareId]=" + vibe.dbQuote(shareId)
+ " AND [parentId]=(SELECT parentId FROM [items] WHERE hash='" + vibe.dbQuote(hash) + "')"
+ " AND [name] like '%.jp%'"
+ " LIMIT 1";

var result = connection.executeJson(query);

databaseManager.releaseConnection(connection);

response.print(result);
}
}
}
?>[/code2ydzbpcx]

*Default for Vista/7 installs.

Yukiko

13-11-2009 14:02:30

Phil that would be default for 64 bit Vista/Win 7. The default for 32 bit wouldn't have the "(x86)" after "Program Files".

Phil

13-11-2009 16:50:18

Phil that would be default for 64 bit Vista/Win 7. The default for 32 bit wouldn't have the "(x86)" after "Program Files".[/quote2s8jyxde]

Correct which is why I placed an asterisk next to default and put a note at the bottom of my post. D

JChapkin

14-11-2009 07:16:17

Thanks for the help, here you go!


<?@ include file="/_private/functions/vibe.utilities.vibe" ?>
<?@ include file="/_private/functions/vibe.features.vibe" ?>
<?
if ( vibe.getSetting("plugin.nowplaying.enabled")=="true" )

{
var shareId = request.getParameter("shareId");
var hash = request.getParameter("hash");

if ( vibe.isNumeric(shareId) && hash.length>0 )
{
var shareManager = server.getShareManager();
var share = shareManager.findShareByDbId(shareId);
if ( share!=null && share.checkPermission(request.getUser(),request.getRemoteAddress()) )
{
var databaseManager = server.getDatabaseManager();
var connection = databaseManager.getConnection("index",false);
if ( connection!=null )
{
var coverPatterns = vibe.getSetting("plugin.nowplaying.coverpatterns");
if ( coverPatterns!=null )
{
var nameExpression += "AND ([name]='cover.jpg' OR [name]='folder.jpg')"";


var tokens = coverPatterns.split("|");
for ( var i=0,len=tokens.length; i<len; i++ )
{
if ( nameExpression.length>0 ) {
nameExpression +
}

var pattern = tokens;
if ( pattern.indexOf("*")!=-1 ) {
pattern = pattern.replace(/\*/g,"%");
nameExpression += "[name] LIKE 'front.jpg'" + vibe.dbQuote(pattern) + "'front.jpg'";
}
else {
nameExpression += "[name]='front.jpg'" + vibe.dbQuote(pattern) + "'front.jpg'";
}
}

var query = "SELECT [hash] FROM [items] WHERE [shareId]=" + vibe.dbQuote(shareId)
+ " AND [parentId]=(SELECT parentId FROM [items] WHERE hash='" + vibe.dbQuote(hash) + "')"
+ " AND ("'front.jpg'" + nameExpression + ")"
+ " LIMIT 1";


response.print(connection.executeJson(query));
}

databaseManager.releaseConnection(connection);
}
}
}
}
?>

Phil

17-11-2009 18:04:35

You'll want to log in to the client admin console and check 'Now Playing Cover Patterns'.

In the future if you post code please use the code tags which preserves indentation making it easier to read.