| Conditions | 3 |
| Paths | 3 |
| Total Lines | 28 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function getFileList(string $guid): JsonResponse |
||
| 16 | { |
||
| 17 | $nzb = new NZB; |
||
| 18 | |||
| 19 | $rel = Release::getByGuid($guid); |
||
| 20 | if (! $rel) { |
||
| 21 | return response()->json(['error' => 'Release not found'], 404); |
||
| 22 | } |
||
| 23 | |||
| 24 | $nzbpath = $nzb->NZBPath($guid); |
||
| 25 | |||
| 26 | if (! file_exists($nzbpath)) { |
||
|
|
|||
| 27 | return response()->json(['error' => 'NZB file not found'], 404); |
||
| 28 | } |
||
| 29 | |||
| 30 | ob_start(); |
||
| 31 | @readgzfile($nzbpath); |
||
| 32 | $nzbfile = ob_get_clean(); |
||
| 33 | |||
| 34 | $files = $nzb->nzbFileList($nzbfile); |
||
| 35 | |||
| 36 | return response()->json([ |
||
| 37 | 'release' => [ |
||
| 38 | 'guid' => $rel['guid'], |
||
| 39 | 'searchname' => $rel['searchname'], |
||
| 40 | ], |
||
| 41 | 'files' => $files, |
||
| 42 | 'total' => count($files), |
||
| 43 | ]); |
||
| 46 |