Merge branch 'master' into Ocarina-next
Conflicts: Sconstruct tests/Sconscript
This commit is contained in:
commit
77616aa8d2
9
DESIGN
9
DESIGN
|
@ -529,7 +529,8 @@ Tag Database:
|
||||||
|
|
||||||
Track *tagdb :: add_track(const std::string &filepath, Library *library);
|
Track *tagdb :: add_track(const std::string &filepath, Library *library);
|
||||||
Add a new track to the track_db and return a pointer to it.
|
Add a new track to the track_db and return a pointer to it.
|
||||||
Return NULL if this track is already in the database.
|
Return NULL if this track is already in the database or if
|
||||||
|
there is an error when tagging.
|
||||||
|
|
||||||
Library *tagdb :: add_library(const std::string &filepath);
|
Library *tagdb :: add_library(const std::string &filepath);
|
||||||
Add a new path to library_db. Return a pointer to the new path
|
Add a new path to library_db. Return a pointer to the new path
|
||||||
|
@ -758,7 +759,7 @@ Track Tag:
|
||||||
void read(File &);
|
void read(File &);
|
||||||
void write(File &);
|
void write(File &);
|
||||||
|
|
||||||
void tag();
|
bool tag();
|
||||||
const std::string path();
|
const std::string path();
|
||||||
void played();
|
void played();
|
||||||
bool less_than(Track *, sort_t);
|
bool less_than(Track *, sort_t);
|
||||||
|
@ -793,7 +794,7 @@ Track Tag:
|
||||||
void write(File &f);
|
void write(File &f);
|
||||||
Write track information to file.
|
Write track information to file.
|
||||||
|
|
||||||
void Track :: tag();
|
bool Track :: tag();
|
||||||
Use TagLib to find tags and audio properties for this file.
|
Use TagLib to find tags and audio properties for this file.
|
||||||
|
|
||||||
- Insert Artist, Album, and Genre into their databases and
|
- Insert Artist, Album, and Genre into their databases and
|
||||||
|
@ -802,6 +803,8 @@ Track Tag:
|
||||||
- Set play_count, last_year, last_month and last_day = 0.
|
- Set play_count, last_year, last_month and last_day = 0.
|
||||||
- Set lowercase title and find the string form of length.
|
- Set lowercase title and find the string form of length.
|
||||||
|
|
||||||
|
Return true if the track could be tagged and false otherwise.
|
||||||
|
|
||||||
const std::string Track :: path();
|
const std::string Track :: path();
|
||||||
Combine library->path and filepath to find the full path to
|
Combine library->path and filepath to find the full path to
|
||||||
the audio file.
|
the audio file.
|
||||||
|
|
4
PKGBUILD
4
PKGBUILD
|
@ -1,6 +1,6 @@
|
||||||
# Maintainer: Anna Schumaker <anna@ocarinaproject.net>
|
# Maintainer: Anna Schumaker <anna@ocarinaproject.net>
|
||||||
pkgname=ocarina
|
pkgname=ocarina
|
||||||
pkgver=6.1
|
pkgver=6.1.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="A simple GTK and gstreamer based music player."
|
pkgdesc="A simple GTK and gstreamer based music player."
|
||||||
url="http://www.ocarinaproject.net/"
|
url="http://www.ocarinaproject.net/"
|
||||||
|
@ -13,7 +13,7 @@ conflicts=()
|
||||||
replaces=()
|
replaces=()
|
||||||
backup=()
|
backup=()
|
||||||
source=("http://ocarinaproject.net/wp-content/ocarina/${pkgname}-${pkgver}.tar.gz")
|
source=("http://ocarinaproject.net/wp-content/ocarina/${pkgname}-${pkgver}.tar.gz")
|
||||||
sha1sums=('af56a0d391251033ebc35406ed75c8e7d56c307e')
|
sha1sums=('7fa6275aeba85b86988b5a3c88bafc7c6e36ec88')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||||
|
|
|
@ -165,7 +165,8 @@ Track :: Track(const std::string &f, Library *l)
|
||||||
|
|
||||||
Track :: ~Track()
|
Track :: ~Track()
|
||||||
{
|
{
|
||||||
library->count--;
|
if (library)
|
||||||
|
library->count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string Track :: primary_key() const
|
const std::string Track :: primary_key() const
|
||||||
|
@ -232,15 +233,16 @@ static T *find_or_insert(const T &tag, Database<T> &db)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Track :: tag()
|
bool Track :: tag()
|
||||||
{
|
{
|
||||||
TagLib :: Tag *tag;
|
TagLib :: Tag *tag;
|
||||||
TagLib :: AudioProperties *audio;
|
TagLib :: AudioProperties *audio;
|
||||||
TagLib :: FileRef ref(path().c_str(), true, TagLib::AudioProperties::Fast);
|
TagLib :: FileRef ref(path().c_str(), true, TagLib::AudioProperties::Fast);
|
||||||
|
|
||||||
|
library->count++;
|
||||||
if (ref.isNull()) {
|
if (ref.isNull()) {
|
||||||
print("ERROR: Could not read tags for file %s\n", path().c_str());
|
print("WARNING: Could not read tags for file %s\n", path().c_str());
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tag = ref.tag();
|
tag = ref.tag();
|
||||||
|
@ -259,7 +261,7 @@ void Track :: tag()
|
||||||
filter :: add(artist->name, id);
|
filter :: add(artist->name, id);
|
||||||
filter :: add(album->name, id);
|
filter :: add(album->name, id);
|
||||||
|
|
||||||
library->count++;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string Track :: path() const
|
const std::string Track :: path() const
|
||||||
|
@ -366,8 +368,10 @@ void tagdb :: commit_library()
|
||||||
Track *tagdb :: add_track(const std::string &filepath, Library *library)
|
Track *tagdb :: add_track(const std::string &filepath, Library *library)
|
||||||
{
|
{
|
||||||
Track *track = track_db.insert(Track(filepath, library));
|
Track *track = track_db.insert(Track(filepath, library));
|
||||||
if (track)
|
if (track && !track->tag()) {
|
||||||
track->tag();
|
remove_track(track->id);
|
||||||
|
track = NULL;
|
||||||
|
}
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
void read(File &);
|
void read(File &);
|
||||||
void write(File &);
|
void write(File &);
|
||||||
|
|
||||||
void tag();
|
bool tag();
|
||||||
const std::string path() const;
|
const std::string path() const;
|
||||||
void played();
|
void played();
|
||||||
int less_than(Track *, sort_t);
|
int less_than(Track *, sort_t);
|
||||||
|
|
|
@ -217,7 +217,7 @@
|
||||||
<object class="GtkWindow" id="o_window">
|
<object class="GtkWindow" id="o_window">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="title" translatable="yes">Ocarina 6.1</property>
|
<property name="title" translatable="yes">Ocarina 6.1.1</property>
|
||||||
<property name="default_width">1024</property>
|
<property name="default_width">1024</property>
|
||||||
<property name="default_height">683</property>
|
<property name="default_height">683</property>
|
||||||
<child>
|
<child>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
abcdefghijklmnopqrstuvwxyz
|
|
@ -44,7 +44,7 @@ class OTest:
|
||||||
cmd = "%s | tee %s.out" % (path, path)
|
cmd = "%s | tee %s.out" % (path, path)
|
||||||
if test_env.Valgrind == True:
|
if test_env.Valgrind == True:
|
||||||
cmd = "%s %s" % (valgrind, cmd)
|
cmd = "%s %s" % (valgrind, cmd)
|
||||||
test = test_env.Command("%s.out" % self.Name, [], "set -x pipefail; %s" % cmd)
|
test = test_env.Command("%s.out" % self.Name, [], "set -x; set -o pipefail; %s" % cmd)
|
||||||
|
|
||||||
Depends(test, prog)
|
Depends(test, prog)
|
||||||
if (check_depends == True) and (OTest.Prev != None):
|
if (check_depends == True) and (OTest.Prev != None):
|
||||||
|
|
|
@ -96,11 +96,20 @@ static void test_track(struct TagArgs *args)
|
||||||
test_not_equal(track->last_day, args->last_day);
|
test_not_equal(track->last_day, args->last_day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_invalid_track(Library *lib)
|
||||||
|
{
|
||||||
|
unsigned int library_size = lib->count;
|
||||||
|
Track *track = tagdb :: add_track("tests/Music/invalid_track", lib);
|
||||||
|
test_equal(track, TRACK_NULL);
|
||||||
|
test_equal(lib->count, library_size);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_all_tracks()
|
static void test_all_tracks()
|
||||||
{
|
{
|
||||||
struct TagArgs expected;
|
struct TagArgs expected;
|
||||||
|
Library *library = tagdb :: add_library("tests/Music");
|
||||||
|
|
||||||
expected.library = tagdb :: add_library("tests/Music");
|
expected.library = library;
|
||||||
expected.full_path = "tests/Music/1.ogg";
|
expected.full_path = "tests/Music/1.ogg";
|
||||||
expected.artist = "Artist";
|
expected.artist = "Artist";
|
||||||
expected.artist_lower = "artist";
|
expected.artist_lower = "artist";
|
||||||
|
@ -176,6 +185,8 @@ static void test_all_tracks()
|
||||||
expected.filepath = "666.ogg";
|
expected.filepath = "666.ogg";
|
||||||
expected.length_str = "11:06";
|
expected.length_str = "11:06";
|
||||||
run_test("Tags Track Test (666.ogg)", test_track, &expected);
|
run_test("Tags Track Test (666.ogg)", test_track, &expected);
|
||||||
|
|
||||||
|
run_test("Tags Track Test (Invalid)", test_invalid_track, library);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_comparison()
|
static void test_comparison()
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include <tests/test.h>
|
#include <tests/test.h>
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
const std::string expected = "6.1-debug";
|
const std::string expected = "6.2-debug";
|
||||||
#else
|
#else
|
||||||
const std::string expected = "6.1";
|
const std::string expected = "6.2";
|
||||||
#endif /* CONFIG_DEBUG */
|
#endif /* CONFIG_DEBUG */
|
||||||
|
|
||||||
static void test_version()
|
static void test_version()
|
||||||
|
|
|
@ -18,7 +18,7 @@ function tag_file()
|
||||||
mkdir -p /tmp/ocarina/dir{1..5}
|
mkdir -p /tmp/ocarina/dir{1..5}
|
||||||
|
|
||||||
for i in $(seq 5); do
|
for i in $(seq 5); do
|
||||||
cp tests/Music/* /tmp/ocarina/dir$i/
|
cp tests/Music/*.ogg /tmp/ocarina/dir$i/
|
||||||
|
|
||||||
for f in /tmp/ocarina/dir$i/*; do
|
for f in /tmp/ocarina/dir$i/*; do
|
||||||
tag_file $f $i
|
tag_file $f $i
|
||||||
|
|
Loading…
Reference in New Issue