Skip to content

Commit

Permalink
Added Rating, Community Rating and Custom Values
Browse files Browse the repository at this point in the history
  • Loading branch information
Stonepaw committed Sep 26, 2014
1 parent dc81df1 commit ca62572
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Library Organizer.pyproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
Expand Down
18 changes: 18 additions & 0 deletions Library Organizer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Library Organizer", "Library Organizer.pyproj", "{C91C54BF-45ED-4964-B901-9059E4A512A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C91C54BF-45ED-4964-B901-9059E4A512A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C91C54BF-45ED-4964-B901-9059E4A512A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion Package.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name=Library Organizer
Author=Stonepaw
Version=2.1.10
Version=2.1.11
Description=A file and folder organizer with GUI that helps build you file and folder paths.
Image=lopackagelogo.png
KeepFiles=losettingsx.dat
Expand Down
4 changes: 2 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2.1.8
Fix for non-integer values messing up the automatic padding system
2.1.11
Added Rating, Community Rating and Custom Values


31 changes: 28 additions & 3 deletions configureform.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

from loforms import NewIllegalCharacterDialog, GetProfileNameDialog

from locommon import SCRIPTDIRECTORY, ICON, check_excluded_folders, check_metadata_rules
from locommon import SCRIPTDIRECTORY, ICON, check_excluded_folders, check_metadata_rules, get_custom_value_keys

import losettings

Expand Down Expand Up @@ -1602,6 +1602,16 @@ def create_text_insert_controls(self):
self.Title.TabIndex = 11
self._text_insert_controls_list["title"] = self.Title

self.Custom = InsertControlFirstLetter()
self.Custom.SetTemplate("Custom", "Custom")
self.Custom.SetLabels("Prefix", "", "Suffix", "Custom Value")
self.Custom.Location = Point(4, 280)
self.Custom.Tag = self.Custom.Location
self.Custom.Name = "Custom"
self.Custom.SetComboBoxItems(get_custom_value_keys())
self._text_insert_controls_list['custom'] = self.Custom


self._text_insert_controls.Controls.AddRange(System.Array[System.Windows.Forms.Control](self._text_insert_controls_list.Values))


Expand Down Expand Up @@ -1670,10 +1680,24 @@ def create_number_insert_controls(self):
self.Year.Tag = self.Year.Location
self._number_insert_controls_list["year"] = self.Year

self.Rating = InsertControl()
self.Rating.SetTemplate("Rating", "Rating")
self.Rating.Name = "Rating"
self.Rating.Location = Point(4, 190)
self.Rating.Tag = self.Rating.Location
self._number_insert_controls_list['Rating'] = self.Rating

self.CommunityRating = InsertControl()
self.CommunityRating.SetTemplate("CommunityRating", "CommunityRating")
self.CommunityRating.Name = "Rating"
self.CommunityRating.Location =Point(248, 190)
self.CommunityRating.Tag = self.CommunityRating.Location
self._number_insert_controls_list['CommunityRating'] = self.CommunityRating

number_insert_controls_label.Text = "Use a padding of 0 for automatic padding. This is based on the last issue of the series in the library. For example if the last issue number is #50 then the padding will be 2 for all issues in the series."
number_insert_controls_label.AutoSize = True
number_insert_controls_label.MaximumSize = Size(490, 0)
number_insert_controls_label.Location = Point(4, 190)
number_insert_controls_label.Location = Point(4, 235)

self._number_insert_controls.Controls.Add(number_insert_controls_label)
self._number_insert_controls.Controls.AddRange(System.Array[System.Windows.Forms.Control](self._number_insert_controls_list.Values))
Expand Down Expand Up @@ -1962,11 +1986,12 @@ def create_calculated_insert_controls(self):
self.Read = InsertControlReadPercentage()
self.Read.SetTemplate("read", "Read %")
self.Read.SetLabels("Prefix", "", "Suffix", "Text", "Operator", "Percent")
self.Read.Location = Point(4, 450)
self.Read.Location = Point(4, 460)
self.Read.Tag = self.Read.Location
self.Read.Name = "Read Percentage"
self._calculated_insert_controls_list["read percentage"] = self.Read


#
# calculated_insert_controls_start_year_information
#
Expand Down
15 changes: 12 additions & 3 deletions lobookmover.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import System

from System import Func, Action, ArgumentException, ArgumentNullException, NotSupportedException
from System import Func, Action, ArgumentException, ArgumentNullException, NotSupportedException, Single

from System.Text import StringBuilder

Expand Down Expand Up @@ -1206,7 +1206,7 @@ class PathMaker(object):
"manga" : "Manga", "seriesComplete" : "SeriesComplete", "first" : "FirstLetter", "read" : "ReadPercentage",
"counter" : "Counter", "startmonth" : "StartMonth", "startmonth#" : "StartMonth", "colorist" : "Colorist", "coverartist" : "CoverArtist",
"editor" : "Editor", "inker" : "Inker", "letterer" : "Letterer", "locations" : "Locations", "penciller" : "Penciller", "storyarc" : "StoryArc",
"seriesgroup" : "SeriesGroup", "maincharacter" : "MainCharacterOrTeam", "firstissuenumber" : "FirstIssueNumber", "lastissuenumber" : "LastIssueNumber"}
"seriesgroup" : "SeriesGroup", "maincharacter" : "MainCharacterOrTeam", "firstissuenumber" : "FirstIssueNumber", "lastissuenumber" : "LastIssueNumber", "Rating" : "Rating", 'CommunityRating': 'CommunityRating', "Custom" : 'Custom'}

template_regex = re.compile("{(?P<prefix>[^{}<]*)<(?P<name>[^\d\s(>]*)(?P<args>\d*|(?:\([^)]*\))*)>(?P<postfix>[^{}]*)}")

Expand Down Expand Up @@ -1481,6 +1481,9 @@ def get_field_text(self, field, template_name, args_match):
elif field == "LastIssueNumber":
return self.insert_last_issue_number(args_match)

elif field == "Custom":
return self.insert_custom_value(args[0])

elif type(getattr(self.book, field)) is System.DateTime:
if args:
return self.insert_formated_datetime(args[0], field)
Expand Down Expand Up @@ -1728,6 +1731,12 @@ def insert_formated_datetime(self, time_format, field):
return date_time.ToString(time_format)
return date_time.ToString()

def insert_custom_value(self, key):
r = self.book.GetCustomValue(key)
if r is None:
return ""
return r

def insert_first_issue_number(self, padding):
"""
padding is the padding used, can be none.
Expand Down Expand Up @@ -1969,7 +1978,7 @@ def pad(self, value, padding):
except ValueError:
return value

if type(value) == int:
if type(value) in (int, System.Single):
value = str(value)

if numberValue >= 0:
Expand Down
10 changes: 10 additions & 0 deletions locommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,3 +639,13 @@ def check_excluded_folders(book_path, profile):
if path in book_path:
return False
return True


def get_custom_value_keys():
"""Retrieves a list of all the custom value keys in the library"""
keys = []
for book in ComicRack.App.GetLibraryBooks():
for pair in book.GetCustomValues():
if pair.Key not in keys:
keys.append(pair.Key)
return keys

0 comments on commit ca62572

Please sign in to comment.