Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Movie class seperated.

Movies class for search and Movie class for movie info. Also you can
iterate movies using Movies.iter_movies(). It returns Movie object for
each movie.
  • Loading branch information...
commit e97a4929bea22c5ba55f593533524615503abdde 1 parent 889122b
@doganaydin authored
View
6 .gitignore
@@ -0,0 +1,6 @@
+.idea/
+__pycache__/
+
+.idea/workspace.xml
+
+__pycache__/tmdb.cpython-33.pyc
View
221 .idea/workspace.xml
@@ -1,221 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ChangeListManager">
- <list default="true" id="71bdc08c-eb86-41fc-9a3d-f38bbbcc8322" name="Default" comment="">
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tmdb.py" afterPath="$PROJECT_DIR$/tmdb.py" />
- </list>
- <ignored path="themoviedb.iws" />
- <ignored path=".idea/workspace.xml" />
- <option name="TRACKING_ENABLED" value="true" />
- <option name="SHOW_DIALOG" value="false" />
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
- <option name="LAST_RESOLUTION" value="IGNORE" />
- </component>
- <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
- <component name="CreatePatchCommitExecutor">
- <option name="PATCH_PATH" value="" />
- </component>
- <component name="DaemonCodeAnalyzer">
- <disable_hints />
- </component>
- <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
- <component name="FileEditorManager">
- <leaf>
- <file leaf-file-name="tmdb.py" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/tmdb.py">
- <provider selected="true" editor-type-id="text-editor">
- <state line="93" column="12" selection-start="4524" selection-end="4524" vertical-scroll-proportion="0.6734007">
- <folding>
- <element signature="e#407#2965#0" expanded="false" />
- <element signature="e#2992#4510#0" expanded="false" />
- <element signature="e#4536#6232#0" expanded="false" />
- <element signature="e#6257#9105#0" expanded="false" />
- <element signature="e#9131#12513#0" expanded="false" />
- <element signature="e#12540#14388#0" expanded="false" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- </leaf>
- </component>
- <component name="FindManager">
- <FindUsagesManager>
- <setting name="OPEN_NEW_TAB" value="false" />
- </FindUsagesManager>
- </component>
- <component name="Git.Settings">
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
- </component>
- <component name="HighlightingSettingsPerFile">
- <setting file="file://$PROJECT_DIR$/tmdb.py" root0="SKIP_INSPECTION" />
- </component>
- <component name="IdeDocumentHistory">
- <option name="changedFiles">
- <list>
- <option value="$PROJECT_DIR$/tmdb.py" />
- </list>
- </option>
- </component>
- <component name="ProjectFrameBounds">
- <option name="y" value="22" />
- <option name="width" value="1366" />
- <option name="height" value="742" />
- </component>
- <component name="ProjectLevelVcsManager" settingsEditedManually="false">
- <OptionsSetting value="true" id="Add" />
- <OptionsSetting value="true" id="Remove" />
- <OptionsSetting value="true" id="Checkout" />
- <OptionsSetting value="true" id="Update" />
- <OptionsSetting value="true" id="Status" />
- <OptionsSetting value="true" id="Edit" />
- <ConfirmationsSetting value="1" id="Add" />
- <ConfirmationsSetting value="0" id="Remove" />
- </component>
- <component name="ProjectReloadState">
- <option name="STATE" value="0" />
- </component>
- <component name="ProjectView">
- <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
- <flattenPackages />
- <showMembers />
- <showModules />
- <showLibraryContents />
- <hideEmptyPackages />
- <abbreviatePackageNames />
- <autoscrollToSource />
- <autoscrollFromSource />
- <sortByType />
- </navigator>
- <panes>
- <pane id="ProjectPane">
- <subPane>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="themoviedb" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="themoviedb" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="themoviedb" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- </subPane>
- </pane>
- <pane id="Scope" />
- </panes>
- </component>
- <component name="PropertiesComponent">
- <property name="WebServerToolWindowFactoryState" value="false" />
- </component>
- <component name="RunManager">
- <list size="0" />
- </component>
- <component name="ShelveChangesManager" show_recycled="false" />
- <component name="TaskManager">
- <task active="true" id="Default" summary="Default task">
- <created>1352394363089</created>
- <updated>1352394363089</updated>
- </task>
- <servers />
- </component>
- <component name="ToolWindowManager">
- <frame x="0" y="22" width="1366" height="742" extended-state="6" />
- <editor active="true" />
- <layout>
- <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
- <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
- <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
- <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
- <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
- <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
- <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
- <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
- <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
- <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
- </layout>
- </component>
- <component name="VcsContentAnnotationSettings">
- <option name="myLimit" value="2678400000" />
- </component>
- <component name="VcsManagerConfiguration">
- <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
- <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
- <option name="CHECK_NEW_TODO" value="true" />
- <option name="myTodoPanelSettings">
- <value>
- <are-packages-shown value="false" />
- <are-modules-shown value="false" />
- <flatten-packages value="false" />
- <is-autoscroll-to-source value="false" />
- </value>
- </option>
- <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
- <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
- <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
- <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
- <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
- <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
- <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
- <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
- <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
- <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
- <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
- <option name="SHORT_DIFF_HORISONTALLY" value="true" />
- <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
- <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
- <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
- <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
- <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
- <option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
- <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
- <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
- <option name="LAST_COMMIT_MESSAGE" />
- <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
- <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
- <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
- <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
- <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
- <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
- <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
- <option name="ACTIVE_VCS_NAME" />
- <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
- <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
- <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
- <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
- </component>
- <component name="XDebuggerManager">
- <breakpoint-manager />
- </component>
- <component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/tmdb.py">
- <provider selected="true" editor-type-id="text-editor">
- <state line="93" column="12" selection-start="4524" selection-end="4524" vertical-scroll-proportion="0.6734007">
- <folding>
- <element signature="e#407#2965#0" expanded="false" />
- <element signature="e#2992#4510#0" expanded="false" />
- <element signature="e#4536#6232#0" expanded="false" />
- <element signature="e#6257#9105#0" expanded="false" />
- <element signature="e#9131#12513#0" expanded="false" />
- <element signature="e#12540#14388#0" expanded="false" />
- </folding>
- </state>
- </provider>
- </entry>
- </component>
-</project>
-
View
BIN  __pycache__/tmdb.cpython-33.pyc
Binary file not shown
View
14 tmdb.py
@@ -97,17 +97,25 @@ def __init__(self, title="", limit=False):
self.update_configuration()
title = self.escape(title)
self.movies = self.getJSON(config['urls']['movie.search'] % (title,str(1)))
- self.movies_full = ""
pages = self.movies["total_pages"]
if not self.limit:
- for i in range(int(pages)):
- self.movies["results"].extend(self.getJSON(config['urls']['movie.search'] % (title,str(i)))["results"])
+ if int(pages) > 1: #
+ for i in range(2,int(pages)+1): # Thanks @tBuLi
+ self.movies["results"].extend(self.getJSON(config['urls']['movie.search'] % (title,str(i)))["results"])
def get_total_results(self):
if self.limit:
return len(self.movies["results"])
return self.movies["total_results"]
+ def iter_movies(self):
+ for i in self.movies["results"]:
+ yield Movie(i["id"])
+
+ def iter_results(self):
+ for i in self.movies["results"]:
+ yield i
+
def get_id(self,movie_index=0):
return self.movies["results"][movie_index]["id"]
Please sign in to comment.
Something went wrong with that request. Please try again.