Commentek

This commit is contained in:
2026-03-11 17:49:59 +01:00
parent 3a97f29170
commit 32512d0dd6
2 changed files with 20 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import com.example.video_downloader.dto.SaveNewVideoRequest;
import com.example.video_downloader.entity.StatusEnum; import com.example.video_downloader.entity.StatusEnum;
import com.example.video_downloader.entity.Video; import com.example.video_downloader.entity.Video;
import com.example.video_downloader.repositories.VideoRepository; import com.example.video_downloader.repositories.VideoRepository;
import jakarta.persistence.EntityNotFoundException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -32,6 +33,7 @@ public class VideoService {
} }
public Video getVideoById(Long id){ public Video getVideoById(Long id){
//FIXME Throwolj EntityNotFoundException-t
return videoRepository.findById(id) return videoRepository.findById(id)
.orElseThrow(() -> new RuntimeException("Video not found with id: " + id)); .orElseThrow(() -> new RuntimeException("Video not found with id: " + id));
} }

View File

@@ -7,6 +7,8 @@ import com.example.video_downloader.entity.Video;
import com.example.video_downloader.repositories.CreatorRepository; import com.example.video_downloader.repositories.CreatorRepository;
import com.example.video_downloader.repositories.PlaylistRepository; import com.example.video_downloader.repositories.PlaylistRepository;
import com.example.video_downloader.repositories.VideoRepository; import com.example.video_downloader.repositories.VideoRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpClientErrorException;
@@ -20,6 +22,15 @@ import java.util.List;
@Service @Service
public class YTDLPService { public class YTDLPService {
Logger LOGGER = LoggerFactory.getLogger(YTDLPService.class);
/* FIXME
* LOGGER.debug("Valami szoveg: {}", valtozo);
* LOGGER.warn("Valami szoveg: {}", valtozo);
* LOGGER.info("Valami szoveg: {}", valtozo);
* LOGGER.error("Valami szoveg: {}", valtozo);
* mindegyik ugyan ugy mukodik, csak a log levelt be lehet allitani propertykent es akkor ha mondjuk error a loglevel akkor a debug logokat nem irja ki csak ami errorkent van logolva
*
* */
@Autowired @Autowired
private VideoRepository videoRepository; private VideoRepository videoRepository;
@@ -47,6 +58,13 @@ public class YTDLPService {
video.getPlaylist().add(playlist); video.getPlaylist().add(playlist);
videoRepository.save(video); videoRepository.save(video);
} }
/* FIXME itt ugye fogod a playlistet es lemented az osszes hozza tartozo videot.
Ha ezzel vegeztel, akkor a playlist-nek a statuszat at kene allitani NEW-rol, *valamire*
Kene keresni valami elnevezest arra hogy "a playlistben levo videokat meg nem toltottem le, de az video entityket mar letrehoztam"
Pl.: PROCESSED bar nem vagyok benne biztos hogy ez lenne a legjobb nev ra.
Amit mondani akarok az az hogy ha ez a methodus lefutott, akkor ha ranezek a DB-re akkor nem tudom megkulonboztetni egy playlisten hogy csak most lett bekuldve,
vs mar elkezdtuk feldolgozni, es lementeni a hozza tartozo videokat.
* */
} }