-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
280 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
*.db filter=lfs diff=lfs merge=lfs -text | ||
*.u8 filter=lfs diff=lfs merge=lfs -text | ||
yomi_base/mplayer/subfont.ttf filter=lfs diff=lfs merge=lfs -text | ||
yomi_base/japanese/dictionary.zip filter=lfs diff=lfs merge=lfs -text | ||
yomi_base/korean/dictionary.zip filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
*.pyc | ||
*.zip | ||
yomichan.zip | ||
yomichan_dicts.zip | ||
tools.zip | ||
tools | ||
*.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
"""A more or less complete user-defined wrapper around list objects.""" | ||
|
||
import collections | ||
|
||
class UserList(collections.MutableSequence): | ||
def __init__(self, initlist=None): | ||
self.data = [] | ||
if initlist is not None: | ||
# XXX should this accept an arbitrary sequence? | ||
if type(initlist) == type(self.data): | ||
self.data[:] = initlist | ||
elif isinstance(initlist, UserList): | ||
self.data[:] = initlist.data[:] | ||
else: | ||
self.data = list(initlist) | ||
def __repr__(self): return repr(self.data) | ||
def __lt__(self, other): return self.data < self.__cast(other) | ||
def __le__(self, other): return self.data <= self.__cast(other) | ||
def __eq__(self, other): return self.data == self.__cast(other) | ||
def __ne__(self, other): return self.data != self.__cast(other) | ||
def __gt__(self, other): return self.data > self.__cast(other) | ||
def __ge__(self, other): return self.data >= self.__cast(other) | ||
def __cast(self, other): | ||
if isinstance(other, UserList): return other.data | ||
else: return other | ||
def __cmp__(self, other): | ||
return cmp(self.data, self.__cast(other)) | ||
__hash__ = None # Mutable sequence, so not hashable | ||
def __contains__(self, item): return item in self.data | ||
def __len__(self): return len(self.data) | ||
def __getitem__(self, i): return self.data[i] | ||
def __setitem__(self, i, item): self.data[i] = item | ||
def __delitem__(self, i): del self.data[i] | ||
def __getslice__(self, i, j): | ||
i = max(i, 0); j = max(j, 0) | ||
return self.__class__(self.data[i:j]) | ||
def __setslice__(self, i, j, other): | ||
i = max(i, 0); j = max(j, 0) | ||
if isinstance(other, UserList): | ||
self.data[i:j] = other.data | ||
elif isinstance(other, type(self.data)): | ||
self.data[i:j] = other | ||
else: | ||
self.data[i:j] = list(other) | ||
def __delslice__(self, i, j): | ||
i = max(i, 0); j = max(j, 0) | ||
del self.data[i:j] | ||
def __add__(self, other): | ||
if isinstance(other, UserList): | ||
return self.__class__(self.data + other.data) | ||
elif isinstance(other, type(self.data)): | ||
return self.__class__(self.data + other) | ||
else: | ||
return self.__class__(self.data + list(other)) | ||
def __radd__(self, other): | ||
if isinstance(other, UserList): | ||
return self.__class__(other.data + self.data) | ||
elif isinstance(other, type(self.data)): | ||
return self.__class__(other + self.data) | ||
else: | ||
return self.__class__(list(other) + self.data) | ||
def __iadd__(self, other): | ||
if isinstance(other, UserList): | ||
self.data += other.data | ||
elif isinstance(other, type(self.data)): | ||
self.data += other | ||
else: | ||
self.data += list(other) | ||
return self | ||
def __mul__(self, n): | ||
return self.__class__(self.data*n) | ||
__rmul__ = __mul__ | ||
def __imul__(self, n): | ||
self.data *= n | ||
return self | ||
def append(self, item): self.data.append(item) | ||
def insert(self, i, item): self.data.insert(i, item) | ||
def pop(self, i=-1): return self.data.pop(i) | ||
def remove(self, item): self.data.remove(item) | ||
def count(self, item): return self.data.count(item) | ||
def index(self, item, *args): return self.data.index(item, *args) | ||
def reverse(self): self.data.reverse() | ||
def sort(self, *args, **kwds): self.data.sort(*args, **kwds) | ||
def extend(self, other): | ||
if isinstance(other, UserList): | ||
self.data.extend(other.data) | ||
else: | ||
self.data.extend(other) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
./build_zip_core.bat | ||
cd yomi_base/japanese | ||
7z a dictionary.zip dictionary.db | ||
|
||
cd ../korean | ||
7z a dictionary.zip dictionary.db | ||
|
||
cd ../.. | ||
|
||
rm yomichan_dicts.zip | ||
7z a yomichan_dicts.zip yomi_base/japanese/dictionary.db yomi_base/chinese/cedict_ts.u8 yomi_base/korean/dictionary.db | ||
|
||
rm tools.zip | ||
7z a tools.zip tools yomi_base/mplayer/subfont.ttf | ||
|
||
call build_zip_core.bat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
rm yomichan.zip | ||
7z a yomichan.zip -x!yomi_base/japanese/dictionary.db -x!yomi_base/chinese/cedict_ts.u8 -x!yomi_base/korean/dictionary.db -x!yomi_base/mplayer/subfont.ttf yomichan.py UserList.py yomi_base | ||
7z a yomichan.zip -x!yomi_base/japanese/dictionary.zip -x!yomi_base/japanese/dictionary.db -x!yomi_base/chinese/cedict_ts.u8 -x!yomi_base/korean/dictionary.db -x!yomi_base/korean/dictionary.zip -x!yomi_base/mplayer/subfont.ttf yomichan.py UserList.py yomi_base | ||
cd pysrt | ||
7z a ..\yomichan.zip pysrt | ||
7z a ..\yomichan.zip pysrt | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.