Skip to content

Commit

Permalink
#12 Click only the Image | #13 Add story line
Browse files Browse the repository at this point in the history
  • Loading branch information
dallaszkorben committed Dec 22, 2018
1 parent edde0aa commit 00191c1
Show file tree
Hide file tree
Showing 11 changed files with 380 additions and 185 deletions.
1 change: 0 additions & 1 deletion akoteka.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
from akoteka.gui import main_window

if __name__ == "__main__":

main_window.main()
97 changes: 82 additions & 15 deletions akoteka/accessories.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import configparser
import cgi, cgitb

pattern_media = re.compile("^.+[.](avi|mpg|mkv|mp4|flv)$")
pattern_media = re.compile("^.+[.](avi|mpg|mkv|mp4|flv|mp3)$")
pattern_image = re.compile( "^image[.]jp(eg|g)$" )
pattern_card = re.compile("^card.ini$")

Expand Down Expand Up @@ -97,6 +97,11 @@ def folder_investigation( actual_dir, json_list):
title_json_list['hu'] = media_name
title_json_list['en'] = media_name
card['title'] = title_json_list

storyline_json_list = {}
storyline_json_list['hu'] = ""
storyline_json_list['en'] = ""
card['storyline'] = storyline_json_list

general_json_list = {}
general_json_list['year'] = ""
Expand Down Expand Up @@ -171,59 +176,117 @@ def folder_investigation( actual_dir, json_list):
# first collect every data from the card
parser = configparser.RawConfigParser()
parser.read(card_path_os)

try:

# save the http path of the image
card['extra']['image-path'] = image_path_os
card['extra']['image-path'] = image_path_os
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
# saves the os path of the media
card['extra']['media-path'] = media_path_os

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['title']['hu'] = parser.get("titles", "title_hu")
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['title']['en'] = parser.get("titles", "title_en")

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['storyline']['hu'] = parser.get("storyline", "storyline_hu")
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['storyline']['en'] = parser.get("storyline", "storyline_en")
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['general']['year'] = parser.get("general", "year")

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
directors = parser.get("general", "director").split(",")
for director in directors:
card['general']['director'].append(director.strip())

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['general']['length'] = parser.get("general", "length")

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
sounds = parser.get("general", "sound").split(",")
for sound in sounds:
card['general']['sound'].append(sound.strip())
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
subs = parser.get("general", "sub").split(",")
for sub in subs:
card['general']['sub'].append(sub.strip())
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
genres = parser.get("general", "genre").split(",")
for genre in genres:
card['general']['genre'].append(genre.strip())
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
themes = parser.get("general", "theme").split(",")
for theme in themes:
card['general']['theme'].append(theme.strip())

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
actors = parser.get("general", "actor").split(",")
for actor in actors:
card['general']['actor'].append(actor.strip())
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
countries = parser.get("general", "country").split(",")
for country in countries:
card['general']['country'].append(country.strip())

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['rating']['best'] = parser.get("rating", "best")
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['rating']['new'] = parser.get("rating", "new")
except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['rating']['favorite'] = parser.get("rating", "favorite")

except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
log_msg(nop_err, "in ", card_path_os)

try:
card['links']['imdb'] = parser.get("links", "imdb")


except (configparser.NoSectionError, configparser.NoOptionError) as nop_err:
print(nop_err, "in ", card_path_os)
# TODO It could be more sophisticated, depending what field failed
log_msg(nop_err, "in ", card_path_os)

json_list.append(card)

Expand All @@ -248,6 +311,10 @@ def folder_investigation( actual_dir, json_list):
# and finaly returns
return

def log_msg(par1, par2, par3):
print(par1, par2, par3)


def collect_cards( rootdirs ):
media_list = json.loads('[]')

Expand Down
47 changes: 47 additions & 0 deletions akoteka/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

#
WINDOW_WIDTH = 400
WINDOW_HEIGHT = 120
IMG_SIZE = 16
LABEL_LENGTH = 120
LANGUAGE_DROPDOWN_LENGTH = "120"

#
PICTURE_WIDTH = 190
PICTURE_HEIGHT = 160
RATE_WIDTH = 30

INFO_LABEL_WIDTH = 65
INFO_FONT_SIZE = 10
INFO_TITLE_FONT_SIZE = 18
ONE_LINE_HEIGHT = 18
FONT_TYPE = "Comic Sans MS"

COLOR_CARD = "#b3d4c9"
COLOR_CARD_BORDER_MEDIA = "#b3d4c9"
COLOR_CARD_BORDER_CONTAINER = "#0e997a"
COLOR_CARD_HOLDER_CARDS = "#3f6b61"
COLOR_CARD_HOLDER_MAIN = "#73948d"

#
SECTION_RATING = 'rating'
SECTION_GENERAL = 'general'
SECTION_TITLE = 'title'
SECTION_EXTRA = 'extra'

RATING_KEY_FAVORITE = 'favorite'
RATING_KEY_NEW = 'new'
RATING_KEY_BEST = 'best'

FILE_CARD_INI = 'card.ini'

IMG_CONFIG_BUTTON = "cogwheel-button.png"
IMG_BACK_BUTTON = "back-button.png"
IMG_FOLDER_BUTTON = "folder.png"
IMG_EMPTY_BUTTON = "empty.png"
IMG_BEST_ON = "best-on.png"
IMG_BEST_OFF = "best-off.png"
IMG_NEW_ON = "new-on.png"
IMG_NEW_OFF = "new-off.png"
IMG_FAVORITE_ON = "favorite-on.png"
IMG_FAVORITE_OFF = "favorite-off.png"
10 changes: 10 additions & 0 deletions akoteka/dict/resources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ title_director = Director
title_actor = Actors
title_year = Year
title_country = Country
title_storyline = Story
title_best = Best
title_new = New
title_favorite = Favorite
Expand Down Expand Up @@ -53,6 +54,7 @@ genre_biography = Biography
genre_animation = Animation
genre_history = History
genre_documentary = Documentary
genre_talk = Talk

theme_revenge = Revenge
theme_love = Love
Expand Down Expand Up @@ -92,13 +94,21 @@ theme_greed = Greed
theme_small_man_rebellion = Rebellion of a small man
theme_stupidity = Stupidity
theme_concern_future = Concern for the future
theme_bureaucracy = Bureaucracy
theme_meaning_of_life = Meaning of life
theme_destiny = Destiny
theme_virtual_reality = Virtual Reality
theme_godless_world = Godless World
theme_inhumanity = Inhumanity
theme_prejudice = Prejudice

lang_hu = Hungarian
lang_en = English
lang_sv = Swedish
lang_fr = French
lang_sp = Spanish
lang_it = Italian
lang_ge = German

country_hu = Hungary
country_us = USA
Expand Down
9 changes: 9 additions & 0 deletions akoteka/dict/resources_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ title_director = Director
title_actor = Actors
title_year = Year
title_country = Country
title_storyline = Story
title_best = Best
title_new = New
title_favorite = Favorite
Expand Down Expand Up @@ -53,6 +54,7 @@ genre_biography = Biography
genre_animation = Animation
genre_history = History
genre_documentary = Documentary
genre_talk = Talk

theme_revenge = Revenge
theme_love = Love
Expand Down Expand Up @@ -92,6 +94,13 @@ theme_greed = Greed
theme_small_man_rebellion = Rebellion of a small man
theme_stupidity = Stupidity
theme_concern_future = Concern for the future
theme_bureaucracy = Bureaucracy
theme_meaning_of_life = Meaning of life
theme_destiny = Destiny
theme_virtual_reality = Virtual Reality
theme_godless_world = Godless World
theme_inhumanity = Inhumanity
theme_prejudice = Prejudice

lang_hu = Hungarian
lang_en = English
Expand Down
9 changes: 9 additions & 0 deletions akoteka/dict/resources_hu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ title_director = Rendező
title_actor = Szereplők
title_year = Év
title_country = Ország
title_storyline = Történet
title_best = Legjobbak
title_new = Újak
title_favorite = Kedvencek
Expand Down Expand Up @@ -53,6 +54,7 @@ genre_biography = Életrajz
genre_animation = Animáció
genre_history = Történelem
genre_documentary = Dokumentum film
genre_talk = Beszélgetés

theme_revenge = Bosszú
theme_love = Szerelem
Expand Down Expand Up @@ -92,6 +94,13 @@ theme_greed = Kapzsiság
theme_small_man_rebellion = A kis ember lázadása
theme_stupidity = Ostobaság
theme_concern_future = Aggódás a jövőért
theme_bureaucracy = Bürokrácia
theme_meaning_of_life = Az élet értelme
theme_destiny = Sors
theme_virtual_reality = Virtuális valóság
theme_godless_world = Istentelen világ
theme_inhumanity = Embertelenség
theme_prejudice = Előítélet

lang_hu = Magyar
lang_en = Angol
Expand Down
Loading

0 comments on commit 00191c1

Please sign in to comment.