umpaper-fetch 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
umpaper_fetch/__init__.py CHANGED
@@ -5,7 +5,7 @@ This package provides tools to automatically download past year exam papers
5
5
  from University Malaya's repository through an automated browser interface.
6
6
  """
7
7
 
8
- __version__ = "1.0.1"
8
+ __version__ = "1.0.3"
9
9
  __author__ = "Marcus Mah"
10
10
  __email__ = "marcusmah6969@gmail.com"
11
11
  __description__ = "Automated downloader for University Malaya past year exam papers"
umpaper_fetch/cli.py CHANGED
@@ -273,10 +273,10 @@ def main():
273
273
  print(f"📄 FOUND {len(papers)} PAST YEAR PAPERS FOR {subject_code}")
274
274
  print(f"{'='*80}")
275
275
  for i, paper in enumerate(papers, 1):
276
- print(f"{i:2d}. {paper['title']}")
277
- print(f" 📅 Year: {paper['year']}, Semester: {paper['semester']}")
278
- print(f" 📝 Type: {paper['paper_type']}")
279
- print(f" 🔗 URL: {paper['pdf_url']}")
276
+ print(f"{i:2d}. {paper.title}")
277
+ print(f" 📅 Year: {paper.year}, Semester: {paper.semester}")
278
+ print(f" 📝 Type: {paper.paper_type}")
279
+ print(f" 🔗 URL: {paper.download_url}")
280
280
  print()
281
281
 
282
282
  # Ask user if they want to download all papers
@@ -311,14 +311,33 @@ def main():
311
311
  print(f"📁 Individual files: {output_dir / subject_code}")
312
312
 
313
313
  # Ask if user wants to delete individual files
314
- print(f"\n📁 Individual PDF files are still in: {output_dir / subject_code}")
314
+ subject_dir = output_dir / subject_code
315
+ print(f"\n📁 Individual PDF files are still in: {subject_dir}")
315
316
  delete_confirm = input("Delete individual files to save space? (y/N): ").strip().lower()
316
317
  if delete_confirm in ['y', 'yes']:
317
318
  try:
318
- import shutil
319
- shutil.rmtree(output_dir / subject_code)
320
- print("✅ Individual files deleted successfully")
321
- logger.info("Individual files deleted by user request")
319
+ # Delete individual PDF files
320
+ deleted_count = 0
321
+ for file_path in downloaded_files:
322
+ try:
323
+ file_path = Path(file_path)
324
+ if file_path.exists():
325
+ file_path.unlink()
326
+ deleted_count += 1
327
+ logger.debug(f"Deleted: {file_path}")
328
+ except Exception as file_error:
329
+ logger.warning(f"Could not delete {file_path}: {file_error}")
330
+
331
+ # Try to remove the subject directory if it's empty
332
+ try:
333
+ if subject_dir.exists() and not any(subject_dir.iterdir()):
334
+ subject_dir.rmdir()
335
+ logger.debug(f"Removed empty directory: {subject_dir}")
336
+ except Exception as dir_error:
337
+ logger.debug(f"Could not remove directory {subject_dir}: {dir_error}")
338
+
339
+ print(f"✅ Individual files deleted successfully ({deleted_count} files)")
340
+ logger.info(f"Individual files deleted by user request ({deleted_count} files)")
322
341
  except Exception as e:
323
342
  print(f"⚠️ Failed to delete individual files: {e}")
324
343
  logger.warning(f"Failed to delete individual files: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umpaper-fetch
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Automated downloader for University Malaya past year exam papers
5
5
  Home-page: https://github.com/MarcusMQF/umpaper-fetch
6
6
  Author: Marcus Mah
@@ -5,8 +5,8 @@ downloader/__init__.py,sha256=Qq3Oex541SjsJBe4Tx2lR7BjCHbPZaGGAscWaU3gUB4,21
5
5
  downloader/pdf_downloader.py,sha256=5g9_suFe6rG7Vjny7gScRkCSVPiYxKwB7NH8PTPR2Z0,7957
6
6
  scraper/__init__.py,sha256=cNGEi--R5BTUOwpnANA2BsR2yfnmG9qrwagEOtzI0E4,18
7
7
  scraper/paper_scraper.py,sha256=NNnJ6eFxgueJfYwZFbTbsnxMAUUbIM0A72q0QNubaVk,12970
8
- umpaper_fetch/__init__.py,sha256=Xs37vDkvGGw5O4hhSQfLyMf3QQAFMZ0Elx8ZFMr-2To,830
9
- umpaper_fetch/cli.py,sha256=HoZbiU7OLbXjcJwUoSoKj5jJi_VAFFPT4q2pkfUkY2o,12445
8
+ umpaper_fetch/__init__.py,sha256=gBwV_tMA89SB_APDQ4n3lwhlG2AYQ4Z-LoArsUgRxcI,830
9
+ umpaper_fetch/cli.py,sha256=XnWr5e6B0bBcaRt9Ra-4ZmjjtbkdDneSmxt-AEg3WxM,13545
10
10
  umpaper_fetch/auth/__init__.py,sha256=AMRDJpqoFyQt3kcRcihx7LMAIFmWeJe_wfy-i4JyUXs,25
11
11
  umpaper_fetch/auth/chrome_fix.py,sha256=sSTvUIWLme5e-raXCM_AJ2IkK3PHSrxNv_g7itSolkg,3828
12
12
  umpaper_fetch/auth/um_authenticator.py,sha256=Rii9E6-2MvE_orcMW4u93tSY8QaT21P_HJeJPExDUzQ,24165
@@ -17,12 +17,12 @@ umpaper_fetch/scraper/paper_scraper.py,sha256=NNnJ6eFxgueJfYwZFbTbsnxMAUUbIM0A72
17
17
  umpaper_fetch/utils/__init__.py,sha256=oukU0ufroPRd8_N8d2xiFes9CTxSaw4NA6p2nS1kkSg,16
18
18
  umpaper_fetch/utils/logger.py,sha256=LJhnN3KoAB9bX4BdfK6bk2urnQEVwG1FFlOeFGbVg7U,2098
19
19
  umpaper_fetch/utils/zip_creator.py,sha256=44dnsMdJRvOktjl4ajDqaxTiYfznbkERzzpcnGogS5I,10731
20
- umpaper_fetch-1.0.1.dist-info/licenses/LICENSE,sha256=bwdpp_9mjxdcCEY-7f8XVEQDoyImNLNDUtYGezKFbFk,1113
20
+ umpaper_fetch-1.0.3.dist-info/licenses/LICENSE,sha256=bwdpp_9mjxdcCEY-7f8XVEQDoyImNLNDUtYGezKFbFk,1113
21
21
  utils/__init__.py,sha256=oukU0ufroPRd8_N8d2xiFes9CTxSaw4NA6p2nS1kkSg,16
22
22
  utils/logger.py,sha256=LJhnN3KoAB9bX4BdfK6bk2urnQEVwG1FFlOeFGbVg7U,2098
23
23
  utils/zip_creator.py,sha256=Mr5rT52vEyNQJB0Cg99r6QTNJBnzqGnnqd3wPK4uaxY,10704
24
- umpaper_fetch-1.0.1.dist-info/METADATA,sha256=UlokHjM9F946ThPCl9Qhhhv-_Z6LC-2q36eanFudxew,15372
25
- umpaper_fetch-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- umpaper_fetch-1.0.1.dist-info/entry_points.txt,sha256=8XnqR8M2yO02n6DcUdJXoSVpgBG4TvaSRNBqi4A_XcQ,53
27
- umpaper_fetch-1.0.1.dist-info/top_level.txt,sha256=NU9S9Nnj8CJvOZvkoKbicMNk0apwlHJjdL6yjU7pnWs,44
28
- umpaper_fetch-1.0.1.dist-info/RECORD,,
24
+ umpaper_fetch-1.0.3.dist-info/METADATA,sha256=-RCwXH8Reu3_qo3Pdfy1btTj3PPGEq2IJRv7XRJAF5k,15372
25
+ umpaper_fetch-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ umpaper_fetch-1.0.3.dist-info/entry_points.txt,sha256=8XnqR8M2yO02n6DcUdJXoSVpgBG4TvaSRNBqi4A_XcQ,53
27
+ umpaper_fetch-1.0.3.dist-info/top_level.txt,sha256=NU9S9Nnj8CJvOZvkoKbicMNk0apwlHJjdL6yjU7pnWs,44
28
+ umpaper_fetch-1.0.3.dist-info/RECORD,,