PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 0ms

/thirdparty/liblastfm2/src/types/Mbid.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 36 lines | 16 code | 1 blank | 19 comment | 2 complexity | dc4d8eeb6b4d3b934ea80796b3087eb8 MD5 | raw file
 1/*
 2   Copyright 2009 Last.fm Ltd. 
 3      - Primarily authored by Max Howell, Jono Cole and Doug Mansell
 4
 5   This file is part of liblastfm.
 6
 7   liblastfm is free software: you can redistribute it and/or modify
 8   it under the terms of the GNU General Public License as published by
 9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   liblastfm is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with liblastfm.  If not, see <http://www.gnu.org/licenses/>.
19*/
20#include "Mbid.h"
21#include "mbid_mp3.c"
22#include <QFile>
23
24namespace lastfm
25{
26    Mbid //static
27    Mbid::fromLocalFile( const QString& path )
28    {   
29        char out[MBID_BUFFER_SIZE];
30        QByteArray const bytes = QFile::encodeName( path );
31        int const r = getMP3_MBID( bytes.data(), out );
32        Mbid mbid;
33        if (r == 0) mbid.id = QString::fromLatin1( out );
34        return mbid;
35    }
36}