aboutsummaryrefslogtreecommitdiff
path: root/README
blob: ebe22effeeb70563230a42a54be83425574b0d76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

E P I S O D E   B R O W S E R
d o c u m e n t a t i o n

Introduction
~~~~~~~~~~~~
Episode Browser is a simple graphical program that offers an interface
to episodes of TV series stored on the local hard drive. It offers
ways of keeping track of watched and unwatched episodes, as well as
fetching episode information from the internet.

In its current form, it is designed specifically for Detective Conan.

Backend
~~~~~~~
The fundamental features of Episode Browser, such as detecing and
keeping track of local episodes, fetching information from the
internet and interacting with the MPC-HC media player, are implemented
in Prolog (see the pl folder).

At the time of writing, the backend implementation is tightly coupled
to the author's specific system. To be used for anything else than
episodes of Detective Conan stored in a specific folder on the hard
drive, the predicates defined in local_episodes.pl must be modified
and the program recompiled. To fetch episode information from other
sources than Detective Conan World, the episode_data.pl file must be
modified.

Frontend
~~~~~~~~
The graphical interface is implemented in C++ using the Win32 API (see
the c folder). The source code is spread across a small number of
files. For an overview of the classes/functions provided by each file,
see defs.h. In summary:

main.cpp		Entry point and initialization. Contains the main event handler.
listview.cpp		Creates and handles the shared aspects of the two list views.
episodelistview.cpp	Defines the interface to the episode list view.
datalistview.cpp	Defines the interface to the data list view.
pl.cpp			Interface to Prolog backend.
common.cpp		Some useful functions that don't fit elsewhere.

In addition, defs.h itself defines a variety of macros and templates.

Building
~~~~~~~~
Episode Browser is built with GNU Make. For the build process, the
following additional programs are required:

 - swipl-ld (included with SWI-Prolog)
 - GCC/G++
 - Perl

To build b/EpisodeBrowser.exe, issue `make' in the root directory of
the project.

Hacking
~~~~~~~
Following is a summary of some coding conventions used in the project.

		      ... HUNGARIAN NOTATION ...

 - p	= pointer
 - b	= bool, BOOL, int (boolean value)
 - i	= integer
 - h	= handle
 - hX	= X handle (e.g., hWnd = HWND)
 - l	= long, LPARAM
 - w	= WORD, WPARAM
 - dw	= DWORD
 - lvi	= LVITEM
 - sz	= unmangaged, zero-terminated string (char *)
 - wsz	= ... wide string (wchar_t *)
 - tsz	= ... tstring (TCHAR *)
 - str	= ... managed string (std::string)
 - wstr	= ... (std::wstring)
 - tstr	= ... (std::basic_string<TCHAR>)

The list above is non-exhaustive. Variables whose type is unknown (in
templates) do not need prefixes. Some very common self-explanatory
variables also do not need prefixes, e.g. len (usually size_t).

			    ... TYPES ...

Here are some general guidelines for choosing what types to use:

1) Don't use Windows-specific types that "hide" pointers.
2) Where there is a Windows-specific type with the same name and
   function as a standard type (e.g., CHAR = char), prefer the
   standard type.
3) Otherwise, prefer the Windows-specific type when interacting with
   the Windows API.

For example, prefer...

 - char*		over LPSTR
 - char const*		over LPCSTR
 - LVITEM*		over LPLVITEM
 - int			over INT
 - DWORD		over unsigned long
			(when interacting with the Windows API)

Note...

 - that the second rule above does not apply to BOOL, which should not
   be replaced with bool, as BOOL is an integer that may have other
   values than 1 and 0.