Ejemplo n.º 1
0
    def stats(self):
        """ controller for the stats widget """

        try:
            m = g.p.connect()
        except ConnectionClosed:
            return render('/null.html')

        c.stats = m.stats()
        aa = AlbumArt()
        c.dir_size = aa.dir_size()

        return render('/stats.html')
Ejemplo n.º 2
0
    def stats(self):
        """ controller for the stats widget """

        try:
            self.m = g.p.connect()
        except (NoMPDConnection, ConnectionClosed):
            return render('/null.html')

        c.stats = self.m.stats()
        aa = AlbumArt()
        c.dir_size = aa.dir_size()

        return render('/stats.html')
Ejemplo n.º 3
0
    def albums(self):
        """ controller for the albums frame """

        c.artist = request.GET.get('artist','').encode('utf-8')
        c.album = request.GET.get('album','').encode('utf-8')

        try:
            m = g.p.connect()
        except ConnectionClosed:
            return render('/null.html')
        c.albums = m.albums(c.artist)

        aa = AlbumArt()
        c.album_imgs = aa.artist_art(c.artist)
        random.shuffle(c.album_imgs)
        return render('/albums.html')
Ejemplo n.º 4
0
    def albums(self):
        """ controller for the albums frame """

        c.artist = request.GET.get('artist', '').encode('utf-8')
        c.album = request.GET.get('album', '').encode('utf-8')

        try:
            self.m = g.p.connect()
        except (NoMPDConnection, ConnectionClosed):
            return render('/null.html')
        c.albums = self.m.albums(c.artist)

        aa = AlbumArt()
        c.album_imgs = aa.artist_art(c.artist)
        random.shuffle(c.album_imgs)
        return render('/albums.html')
Ejemplo n.º 5
0
    def albums(self):
        """ controller for the albums frame """

        c.artist = request.GET.get('artist', u'')
        c.album = request.GET.get('album', u'')

        try:
            self.m = g.p.connect()
        except (NoMPDConnection, ConnectionClosed):
            return render('/null.html')
        c.albums = self.m.albums(c.artist)

        aa = AlbumArt()
        c.album_imgs = aa.artist_art(c.artist)
        random.shuffle(c.album_imgs)
        return render('/albums.html')
Ejemplo n.º 6
0
    def fetchart(self):
        """ 
        creates an AlbumArt object and attemps to load the image from disk.
        if it doesn't exist, attempt to fetch it from Amazon and save to disk 
        """
            
        artist = request.GET.get('artist','').encode('utf-8')
        album = request.GET.get('album','').encode('utf-8')
        response.headers['Content-type'] = 'image/jpeg'

        try:
            aa = AlbumArt()
            aa.album_fetch(artist,album)
            img = aa.disk_path
        except NoArtError:
            response.headers['Content-type'] = 'image/png'
            img = 'theory/public/img/noart.png'


        f = open(img,'rb')
        data = f.read()
        f.close()
        return data
Ejemplo n.º 7
0
    def fetchart(self):
        """ 
        creates an AlbumArt object and attemps to load the image from disk.
        if it doesn't exist, attempt to fetch it from Amazon and save to disk 
        """
            
        artist = request.GET.get('artist', '').encode('utf-8')
        album = request.GET.get('album', '').encode('utf-8')
        response.headers['Content-type'] = 'image/jpeg'

        try:
            aa = AlbumArt()
            aa.album_fetch(artist, album)
            img = aa.disk_path
        except NoArtError:
            response.headers['Content-type'] = 'image/png'
            img = 'theory/public/img/noart.png'


        f = open(img, 'rb')
        data = f.read()
        f.close()
        return data