leepeuker / movary

Self hosted web app to track and rate your watched movies
MIT License
393 stars 14 forks source link

Cannot add some movies #511

Closed SirMartin closed 11 months ago

SirMartin commented 11 months ago

Description

I found an issue adding some fails, it returns a 500 error, and looking in the logs of the container I found this.

[php-fpm:access] 127.0.0.1 - 28/Sep/2023:16:09:45 +0200 "GET /index.php?tmdbId=96581" 200 /app/public/index.php 7.809 2048 0.00% [2023-09-28T16:09:48.837893+02:00] movary.EMERGENCY: No company found by id: 135193 {"exception":"[object] (RuntimeException(code: 0): No company found by id: 135193 at /app/src/Domain/Company/CompanyRepository.php:74)"} []

I made an script to move all my ratings from TMDB to Movary, and from over 2000 ratings, I got issue with these 8 TMDB ids: 96581, 8980, 818, 180, 1913, 8874, 2770, 95932

Version

0.58.0

Steps to Reproduce

  1. Click on Add Movie button.
  2. Search for example for Makinavaja (select the 1992 film) or Mortadelo (in this case choose the 2003 film).
  3. Select the movie
  4. Enter a rating
  5. Click on add play
  6. An error appears

Screenshots

image

Logs

[php-fpm:access] 127.0.0.1 -  28/Sep/2023:16:09:45 +0200 "GET /index.php?tmdbId=96581" 200 /app/public/index.php 7.809 2048 0.00%
[2023-09-28T16:09:48.837893+02:00] movary.EMERGENCY: No company found by id: 135193 {"exception":"[object] (RuntimeException(code: 0): No company found by id: 135193 at /app/src/Domain/Company/CompanyRepository.php:74)"} []

Server OS

Debian

Client Platform

None

Client Device

No response

Client OS

Windows, Linux, Android

Client Browser

Brave

Additional Context

No response

leepeuker commented 11 months ago

Thanks for reporting, I think already know what I have to do to fix this.

I would love to see the script you wrote to move your tmdb ratings, maybe we could add this as a feature or just share it directly for people with a similar use case :)

leepeuker commented 11 months ago

Hm okay sadly my initial idea did not prove correct and I cannot reproduce the error. Could you please provide the log with the whole stack trace? You have to set LOG_ENABLE_STACKTRACE=1 in your env to enable this. Additionally setting LOG_LEVEL=debug would maybe provide some useful context.

SirMartin commented 11 months ago

I'll do it right now, and add it to the thread.

Can you reproduce it?

The script is too crappy right now, but of course, it was my first idea trying to integrate, so if you can help me how and where. I would try to do it. I would try to improve my actual version, so can be automated (right now, I am getting some things hardcoded), and share it with you, so we can integrate it into Movary, it would be awesome.

SirMartin commented 11 months ago

Here it is, I added the 2 envvars, and start and reproduce the bug, and here it is the whole log. _movary_logs.txt

leepeuker commented 11 months ago

Can you reproduce it?

No I cannot, I think you probably have a local state which does not match the data on TMDB anymore and Movary does not know how to handle this, at least we had an issue like this before. Edge cases like this are difficult to see/reproduce and projects like this completely rely on users like you reporting weird stuff like this, so thank you again ;)

Thank you very much for the stack trace, that should enable me to fix the issue.

I would try to improve my actual version, so can be automated (right now, I am getting some things hardcoded), and share it with you, so we can integrate it into Movary, it would be awesome.

Take your time and I am looking forward to it :)

SirMartin commented 11 months ago

Great, one of the problems is that right now I am entering the movies into Movary via log-movie because I couldn't find any option on the available API.

leepeuker commented 11 months ago

An API endpoint for this should come soon, see this issue, it is at least on the list for my next todos :D

SirMartin commented 11 months ago

I saw it, but I didn't want to wait to use your amazing work 🤣


De:Lee Peuker @.***> Enviado:viernes, 29 de septiembre de 2023 14:56 Para:leepeuker/movary Cc: Eduardo; Author Asunto: Re: [leepeuker/movary] Cannot add some movies (Issue #511)

An API endpoint for this should come soon, see this issue, it is at least on the list for my next todos :D — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

leepeuker commented 11 months ago

I found the cause, currently we enforce that the combination of name and country must be unique for companies. You want to add a movie with a production company that does not exist locally (at least not the tmdb id) but there already is a company with the same name and country (for example 135193 and 2354).

I will remove this unique requirement. It seems to make sense that there are multiple companies with the same name but no country. This opens up the risk for duplicates, but I guess that is worth the risk here.

Edit: You are using mysql, correct?

SirMartin commented 11 months ago

Looking both companies films, probably are the same company but for some reason is not the same on tmdb. But sounds good about removing the requirement.

leepeuker commented 11 months ago

Fix will be part of the next release, you can try it out already with the nightly docker image.

SirMartin commented 10 months ago

I have not time, but I just updated I tested it, and works perfectly. Thanks for your amagin work!

SirMartin commented 10 months ago

Hi @leepeuker , it took some time, but finally I had some time and rewrite and make a bit more user friendly the script I talked about for importing to movary from TMDB. I created in a repo, and make some instructions for it, just in case you want to add to Movary's README.

If you are interested into integrate it self on Movary, we can talk about, or feel free to use as much code as you can, is it on Node, so not sure how easy it will be move it to PHP, but I removed the usage of external libraries, so it will be easier.

Here is the link: https://github.com/SirMartin/TMDBToMovary

leepeuker commented 10 months ago

Awesome, thank you! I have created a follow up issue here to import the tmdb ratings.

SirMartin commented 10 months ago

Maybe you can add the info in the README until you finish the wizard way :smile:

leepeuker commented 10 months ago

Good idea, I have added a section to the docs here :+1: