Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lachhebo committed May 11, 2019
1 parent b6e8151 commit d5011f9
Show file tree
Hide file tree
Showing 32 changed files with 1,830 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/window.ui~
tests/__pycache__
src/__pycache__
__pycache__
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

language: python
before_install:
- sudo apt-get update
- sudo apt-get install python-gi
install:
- pip install -r requirements.txt
script :
- pytest -v tests/
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# GabTag [![Build Status](https://travis-ci.org/lachhebo/GabTag.svg?branch=master)](https://travis-ci.org/lachhebo/GabTag)


## Description :

GabTag is a GTK software written in Python, it allows user to add or modify tags on audio files.

It uses Mutagen to handle tags. I hope to make it available on Flathub as soon as possible.

## Features :

- [x] Add, modify or delete basic tags (title, album, artist, genre)
- [ ] other strings tags (less important)
- [ ] Continuous integration
- [x] Modify several file at the same time.
- [x] MP3 file handled
- [ ] Flac File handled
- [ ] Cover tag
- [ ] About window
- [ ] Multi-folder modification



## Screenshots:

![ScreenShot](https://raw.githubusercontent.com/lachhebo/GabTag/screenshots/Image1.png)


## Development Instruction:

GabtTag is written to be as easily maintainable and extensible as possible.

### Contributions :

If you want to contribute, you can add a extension Handler :

- you can just add a new Python file to handle a new extension (like .mp3); you can take as an example the MP3Handler.
- Then add your handler in the moteur.py file


### Installation :

clone this repository

## Acknowledgments :


Ismaël Lachheb : [https://paypal.me/lachhebo?locale.x=fr_FR](https://paypal.me/lachhebo?locale.x=fr_FR)

21 changes: 21 additions & 0 deletions build-aux/meson/postinstall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

from os import environ, path
from subprocess import call

prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')

# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])

print('Updating desktop database...')
call(['update-desktop-database', '-q', path.join(datadir, 'applications')])

print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])


41 changes: 41 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
desktop_file = i18n.merge_file(
input: 'org.gnome.Gabtag.desktop.in',
output: 'org.gnome.Gabtag.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)

desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file', desktop_utils,
args: [desktop_file]
)
endif

appstream_file = i18n.merge_file(
input: 'org.gnome.Gabtag.appdata.xml.in',
output: 'org.gnome.Gabtag.appdata.xml',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'appdata')
)

appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test('Validate appstream file', appstream_util,
args: ['validate', appstream_file]
)
endif

install_data('org.gnome.Gabtag.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)

compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test('Validate schema file', compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()]
)
endif
8 changes: 8 additions & 0 deletions data/org.gnome.Gabtag.appdata.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gnome.Gabtag.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>
</description>
</component>
7 changes: 7 additions & 0 deletions data/org.gnome.Gabtag.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=gabtag
Exec=gabtag
Terminal=false
Type=Application
Categories=GTK;
StartupNotify=true
5 changes: 5 additions & 0 deletions data/org.gnome.Gabtag.gschema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gabtag">
<schema id="org.gnome.Gabtag" path="/org/gnome/Gabtag/">
</schema>
</schemalist>
12 changes: 12 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
project('gabtag', version: '0.1.0',
meson_version: '>= 0.40.0',
)

i18n = import('i18n')


subdir('data')
subdir('src')
subdir('po')

meson.add_install_script('build-aux/meson/postinstall.py')
63 changes: 63 additions & 0 deletions org.gnome.Gabtag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"app-id": "org.gnome.Gabtag",
"runtime": "org.gnome.Platform",
"runtime-version": "3.28",
"sdk": "org.gnome.Sdk",
"command": "gabtag",
"finish-args": [
"--share=network",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"build-options": {
"cflags": "-O2 -g",
"cxxflags": "-O2 -g",
"env": {
"V": "1"
}
},
"cleanup": [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"*.la",
"*.a"
],
"modules": [
{
"name": "python3-mutagen",
"buildsystem": "simple",
"build-commands": [
"pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} mutagen"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/30/4c/5ad1a6e1ccbcfaf6462db727989c302d9d721beedd9b09c11e6f0c7065b0/mutagen-1.42.0.tar.gz",
"sha256": "bb61e2456f59a9a4a259fbc08def6d01ba45a42da8eeaa97d00633b0ec5de71c"
}
]
},
{
"name": "gabtag",
"buildsystem": "meson",
"config-opts": [ "--libdir=lib" ],
"builddir": true,
"sources": [
{
"type": "git",
"url": "file:///home/isma/Projets/GabTag"
}
]
}
]
}
Empty file added po/LINGUAS
Empty file.
7 changes: 7 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data/org.gnome.Gabtag.desktop.in
data/org.gnome.Gabtag.appdata.xml.in
data/org.gnome.Gabtag.gschema.xml
src/window.ui
src/main.py
src/window.py

1 change: 1 addition & 0 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
i18n.gettext('gabtag', preset: 'glib')
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mutagen==1.42.0

29 changes: 29 additions & 0 deletions src/MP3Handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from .audiobasics import AudioBasics
from mutagen.mp3 import EasyMP3, MP3

class MP3Handler(AudioBasics):

def __init__(self,adress):
self.adress = adress
self.audio = EasyMP3(adress)
self.tags = self.audio.tags


def getTag(self,tag_key):
if tag_key in self.tags:
return self.tags[tag_key][0]
else :
return ""

def check_tag_existence(self,key):
return key in self.tags

def setTag(self,tag_key,tag_value):
self.tags[tag_key] = tag_value


def savemodif(self):
self.tags.save(self.adress)



Empty file added src/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions src/audiobasics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import abc

class AudioBasics() :

@abc.abstractmethod
def getTag(self,tag_key):
pass

@abc.abstractmethod
def setTag(self,tag_key,tag_value):
pass

@abc.abstractmethod
def savemodif(self):
pass

@abc.abstractmethod
def check_tag_existence(self,key):
pass
6 changes: 6 additions & 0 deletions src/gabtag.gresource.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Gabtag">
<file>window.ui</file>
</gresource>
</gresources>
41 changes: 41 additions & 0 deletions src/gabtag.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!@PYTHON@

# gabtag.in
#
# Copyright 2019 Ismaël Lachheb
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import sys
import signal
import gettext

VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'

sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
gettext.install('gabtag', localedir)

if __name__ == '__main__':
import gi

from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'gabtag.gresource'))
resource._register()

from gabtag import main
sys.exit(main.main(VERSION))
Loading

0 comments on commit d5011f9

Please sign in to comment.