Coder Social home page Coder Social logo

albumart's Introduction

AlbumArt

This repo was created to preserve a Python3 script albumart.py written by Jean-Francois Dockes (JFD) to leverage his Libupnpp for Control Points and made available by him to the moOde Audio Player project.

The script was found to be missing a debug() function, which was added in my first commit after checking in the original.

The script is intended to be used in moOde as a drop-in replacement for upexplorer, another utility written by JFD in C++. The latter utility leverages JFD's libupnpp functionality to fetch information including, optionally, the albumArtURI from a UPnP/AV renderer playing a track. It worked well in this role but was unable to do the same for an OpenHome renderer. The albumart.py script deals solely with the albumArtURI from either type of renderer.

The backend code in moOde is written primarily in PHP. It invokes upexplorer through a PHP exec() function call as shown in the following code snippet

// get upnp coverart url
function getUpnpCoverUrl() {
        $result = sysCmd('upexplorer --album-art "' . $_SESSION['upnpname'] . '"');
        return $result[0];

where the session variable contains the friendly name of the renderer being queried, for example, 'Moode UPNP' and sysCmd is defined as

function sysCmd($cmd) {
        exec('sudo ' . $cmd . " 2>&1", $output);
        return $output;

In principle, it should have been possible to replace upexplorer --album-art with albumart.py and drive on. In practice, the albumArtURI was not being returned to PHP even though albumart.py worked flawlessly when invoked from the command line. Using sys_exec() in place of exec() with appropriate changes made no difference.

20210114 The culprit turned out to be the use of os._exit() in the Python script. When replaced with sys.exit() the script output gets returned. Changing the exit call was the subject of my next commit.

20210115 No, this "fix" works when the renderer is playing a track but the sys.exit() also flushes error messages from within libupnpp to the output when, for example, there is no track playing. This "fix" needs to be fixed.


Possible future change: integrate logging with the existing moOde/upmpdcli logging scheme.

albumart's People

Contributors

theoldpresbyope avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.