MyP-Proyecto2
Repository for Project 2 in the Modelado y Programación course of Professor
Canek Peláez Valdés at the Faculty of Science, UNAM.
This project consists of a rolas (songs, actually in mp3 format) manager, which
has an SQLite database to perform queries based on the ID3v2 tags of the mp3 files.
The database is populated by a miner that traverses the ~/Music folder, reading
the ID3v2 tags of the mp3 files found, and saving its title, artist, album, genre,
track number, year and attached picture. The tags in the files are not modified,
but the generated entries in the database can be modified through the GUI. A simple
language is implemented to perform complex searches through the GUI.
Language
- go version go1.11 linux/amd64
Dependencies
Installation
Before compiling, gotk3 should be present in the GOPATH, in the path
src/github.com/gotk3/gotk3. It is go getteable through the command
$ go get github.com/gotk3/gotk3/...
Installation for Ubuntu/Debian has the following dependencies:
GTK 3.6-3.16, GLib 2.36-2.40, and Cairo 1.10 or 1.12.
For detailed instructions, refer to: installation
These dependencies can be obtained (Ubuntu/Debian) with the command.
$ sudo apt-get install libgtk-3-dev libcairo2-dev libglib2.0-dev
Once the installation of gotk3 is complete, the following lines should
be added to gtk.go among the other TreeSelection methods, approximately
in line 8582 (a pull request with this changes will be started soon).
// SelectAll() is a wrapper around gtk_tree_selection_select_all().
func (v *TreeSelection) SelectAll() {
C.gtk_tree_selection_select_all(v.native())
}
// UnselectAll() is a wrapper around gtk_tree_selection_unselect_all().
func (v *TreeSelection) UnselectAll() {
C.gtk_tree_selection_unselect_all(v.native())
}
And then, gotk3 should be built again, you can directly use
$ GOPATH/github.com/gotk3/gotk3/go install ./...
Management of ID3v2 tags is done with the tag package, go getteable with
the command
$ go get github.com/dhowden/tag/...
The SQLite controller is go-sqlite3, go getteable with
$ go get github.com/mattn/go-sqlite3
A sqlite administrator is used to retrieve sql commands from an
auxiliary file, we chose dotsql, which can be obtained by the
command
$ go get github.com/gchaincl/dotsql
With all the depencies ready, you can get this package with
$ go get github.com/Japodrilo/MyP-Proyecto2/...
An execultable file should have been generated in the GOPATH/bin
directory. Otherwise, it can be generated by
$ GOPATH/src/github.com/Japodrilo/MyP-Proyecto2/go install ./...
Alternatively, the application can be run directly with go run
$ GOPATH/src/github.com/Japodrilo/MyP-Proyecto2/cmd/rolas/go run rolas.go
Use
The godoc documentation can be found here GoDoc.
The GUI should be intuitive to use, but just in case the button images are not
present in your OS files:
- The leftmost button is for mining rolas from the ~/Music folder and populating the tree view.
- The second button (left to right) is for editing the performer of the rola chosen in the tree view.
- The third button lets you edit an existing performer (person or group), and add member-group relations to the database.
- The rightmost button is for creating a new person or group.
Text introduced in the bar will be searched (case insensitive) in the title,
artist, album and genre fields. Any containent of the text will be considered
a match. Advanced searches should begin with ~ and any of the fields of a
rola can be searched; for any of the fields, the first to letters of the field
name (uppercase) should be wrapped by * *, and an operator should be added right
after this. The operators are:
- ~ for case insensitive containment.
- = for exact match (case sensitive).
- < less than (numeric values only).
- > greater than (numeric values only).
Adding a ! before the operator will result in the negated version of the operator.
Logical and and or can be included with && and ||, respectively. The search will
always be assumed to be in Normal Disjunctive Form.
So, for example
*~* *TI*!~me && *AR*= The Beatles && *YE*<1968 || *TR*<5 && *TR*> 3
would return all the rolas by The Beatles before 1968 without the substring 'me' in
its title, and also all the rolas with track number 4.