How mjacobs95/cinefile works
Project type and purpose
• Cinephile is a standalone Python CLI/tool (not a web-app), whose sole purpose is to find the shortest link between two movies or two actors by querying The Movie Database (TMDB) API and building an in-memory graph.
File structure
Top-level files and folders:
• src/
– api.py → contains DataLoader, handles all HTTP interactions to TMDB
– app.py → CLI entry-point, orchestrates the workflow (parses inputs, invokes NetworkBuilder)
• outputs/ → destination for results of graph building or any serialized output
• tests/ → test suite invoking functions in src/
• requirements.txt → external Python dependencies
There is no persistent database—data lives only in memory during runtime.
README for additional insights
• Cinephile uses an iterative graph-expansion algorithm (in NetworkBuilder)
• The flow is: start with two seed nodes (movie or actor) → expand each node via TMDB API calls → add actors and movies to the graph → repeat until connected or iteration limit reached
• The code references two core modules: DataLoader (api.py) and NetworkBuilder (presumed in src/network.py)
a. Presentation/CLI Layer
– app.py: Parses command-line arguments (seed nodes, iteration limits), kicks off the graph-building process
b. Service/Processing Layer
– NetworkBuilder: Maintains the graph data structure, runs the expansion loop, checks for connectivity
c. Data Access Layer
– DataLoader (in api.py): Sends HTTP requests to TMDB, parses JSON responses into node/edge objects
d. External Service
– TMDB REST API: external HTTP endpoint providing movie/actor data
e. Output
– Graph serialization or image export into outputs/ (could be DOT, JSON, PNG)
Relationships and interactions
1. User invokes app.py (CLI)
2. app.py instantiates NetworkBuilder, passes seed nodes and config
3. NetworkBuilder calls DataLoader for each unexpanded node
4. DataLoader issues REST calls to TMDB and returns structured movie/actor records
5. NetworkBuilder incorporates new nodes/edges into its in-memory graph
6. Loop until graph is connected or iteration limit reached
7. app.py writes final graph or path to outputs/
Architectural patterns and design principles
• Layered architecture: CLI → service → data access → external API
• Single-process, in-memory graph traversal (no database)
• Separation of concerns:
• DataLoader solely responsible for HTTP & parsing
• NetworkBuilder focused on graph logic and search algorithm
• app.py coordinates, without embedding business logic
• Testable units: api.py and network logic can be tested independently in tests/test_all.py
Technologies/Frameworks
• Python 3.x
• requests (or similar) for HTTP in requirements.txt
• Possibly networkx (if used) or custom graph structures
• pytest or unittest for tests
Final touches
User/CLI → Application Layer → Graph Logic Layer → Data Access Layer → External API
→ File System Output